My post contains a bunch of custom fields and is currently being ordered by "over-length"
I have another custom field called "Over-Langtin".
I want to continue to rank my posts as much as possible, but if two posts have the same values for this post, then I would also like it
I am thinking How can I modify my query or add function to execute it?
The current question
OK, I've rewritten the query to use $ wpdb- & gt; get_results, but I still have I'm a little confused about how to go about ordering 2 different custom field orders. This is my new query: I just have to do this work, this is my final query: comes to be honest, when more than one custom field So, its easiest solution is to use You can get a query because it is currently being turned on Then just update the SQL and make a modified loop here. Follow the steps for I: $ loop = new WP_Query (array ( 'post_type' = & gt; 'new', 'orderby' = & gt; 'meta_value_num', ' meta_key '= & gt;' over-length = 'Meta_kweri' & gt; array (array (= 'key' & gt; 'over-made', 'value' = & gt; compare "Dall ' '= & Gt;' like ')));
$ wpdb-> get_results (" SELECT * FROM $ wpdb- & g t; post, wp_postmeta WHERE wp_posts.ID = wp_postmeta.post_id and wp_posts Post_status = 'publish' and wp_posts.post_type = 'new' and wp_postmeta.meta_value = 'Darl' orders, bye ') < P> Now I need to order from my custom field with 'over-LAN' and then 'overlining'
$ wpdb- & gt; get_results ("SELECT * FROM $ wpdb- & gt; Skip docks $ wpdb- & gt; As postmeta Ovrlanpan on ($ wpdb- & gt; posts.ID = Overlength.post_id and overlength.meta_key = 'over-LAN') left Join $ wpdb- & gt; On Ovrlagentin as postmeta ($ wpdb- & gt; posts.ID = overlengthin.post_id and overlengthin.meta_key = 'over-Lnlin') left $ Wpdb- & gt; Overtake as PostMeta ($ wpdb-> posts.ID = Overmaker .post_id and overmarket.mata_key = 'over-make') where wp_posts.post_status = 'publish' and wp_posts.post_type = 'new' and overmake. Matte_value = 'diamond' order + more than + 0-length Meta_Win DESC, 0 + overlagentine. Meta_muly Diissi ");
$ wpdb- & gt; get_results instead of WP_Query.
per dollar $ global ['wp_query'] - & gt; request;
Comments
Post a Comment