Custom product loop in store.php
-
Hi,
I’m pro user… I write request here because support message not work actualy…
I try to add custom query in store page, I use :
<ul class="products"> <?php $args = array( 'post_type' => 'product', 'posts_per_page' => 8, 'product_cat' => $product_cat_id ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) { while ( $loop->have_posts() ) : $loop->the_post(); wc_get_template_part( 'content', 'product' ); endwhile; } else { echo __( 'No products found' ); } wp_reset_postdata(); ?> </ul>
But not work, always product not found, why this simply code not work, it pretty much like this working code :
<?php woocommerce_product_loop_start(); // Add short description in store add_action( 'woocommerce_after_shop_loop_item_title', 'tutsplus_excerpt_in_product_archives', 40 ); ?> <?php while ( have_posts() ) : the_post(); ?> <?php wc_get_template_part( 'content', 'product' ); ?> <?php endwhile; // end of the loop. ?> <?php woocommerce_product_loop_end();
Any chance to make custom product loop in store.php ??
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom product loop in store.php’ is closed to new replies.