Order custom post according to assigned reviews on archive page
-
Problem is –
I am using$args = array('taxonomy' => 'business_category',); $cats = get_categories($args);
to display list of category and when user clicks on one of them,
resulting page is all businesses that have queried business_category.I just want to order these results by there ratings.
So i tried –
$query = new WP_Query([ 'meta_query' => [ ['key' => '_glsr_ranking', 'compare' => '>', 'value' => 0], ], 'order' => 'DESC', 'orderby' => 'meta_value_num', 'post_status' => 'publish', 'post_type' => 'business', // change this as needed 'posts_per_page' => 10, // change this as needed ]);
, but by this I am loosing my default query i.e, on which the businesses were sorted on the basis of there business_category.
////////////////////////////////////////
Just a guess – Can’t we make use of default URL based query in functions.php filefunction tulip_adjust_queries($query){ if (!is_admin() AND is_post_type_archive('business')) { $taxquery = array( array( //some code// ) ); $query->set('tax_query' ,$taxquery); } }
PLS Help……..!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Order custom post according to assigned reviews on archive page’ is closed to new replies.