Reputation: 471
This is the query arguments. I want my products to appear according to categories arranged in the order I want.
$query_args = array(
'post_type' => 'product',
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
'posts_per_page' => $post_per_page,
'orderby' => 'name',
'order' => 'DESC',
'paged' => $paged,
'tax_query' => array(
array('taxonomy' => 'product_cat',
'field' => 'term_id',
'terms' => 12,
'operator' => 'NOT IN',
)
)
);
$wp_query = new WP_Query($query_args);
Means, I want to specify the category order in the query somewhere..
array(3,4,5,7)
And products from category 3 will appear first, then 4, then 5 and so on. How can I achieve this? Tried this plugin, but it seems it's not working with a custom query. https://wordpress.org/plugins/taxonomy-terms-order/
Upvotes: 2
Views: 3864
Reputation: 31
Upvotes: 1