Woocommerce specific loop
-
Hello,
I use OceanWP child theme and WOOF filter plugin.
I want to show only featured products on specific category pages when the url ismysite/category
.
But there must be shown all the products (not only featured) after submitting the filter button and the url becamemysite/category/?swoof=...
I think about some custom query like
$q = new WP_Query([ 'post_type' => 'product', 'meta_query' => [ ['key' => '_featured', 'value' => 'yes' ] ] ]); if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post(); // display endwhile; wp_reset_query(); endif;
But don’t know how to add the condition to the main loop in categories. Can you please help me? Thank you in advance
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Woocommerce specific loop’ is closed to new replies.