I have the following query in my query_posts and want to add order by to this. Order by will be on another custom field and sorted by desc order.
Here is my existing query.
//show all active posts for this taxonomy
query_posts( array(
'post_type' => APP_POST_TYPE,
'post_status' => 'publish',
APP_CUSTOM_TAX => $term->slug,
'ignore_sticky_posts' => 1,
'orderby' => 'date', //Instead of this, i want to use custom field like 'votes','date'
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'offer_type',
'compare' => 'NOT EXISTS',
),
array(
'key' => 'offer_type',
'value' => 'top',
'compare' => '!=',
)
))
);
Please suggest.
'orderby' => 'votes', 'meta_key' => 'votes',
I tried this but doesn't work as expected'orderby' => array('votes','date'), 'meta_key' => 'votes',
– Neha Chopra Jun 23 '18 at 3:34