php - How to orderby woocommerce product categories as in the order I want? -


this query arguments. want products appear according categories arranged in order 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, want specify category order in query somewhere..

array(3,4,5,7) 

and products category 3 appear first, 4, 5 , on. how can achieve this? tried plugin, seems it's not working custom query. https://wordpress.org/plugins/taxonomy-terms-order/

  1. just go under appearance->widgets
  2. list item under sidebar added woocommerce product categories expand "woocommerce product categories"
  3. list item @ order dropdown box choose "category order" instead of name.

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -