Woocommerce custom products list pagination

前端 未结 2 1368
無奈伤痛
無奈伤痛 2021-01-23 16:23

I have code like this for fetching and displaying products in woocommerce:

{
$args = array(
\'post_type\' => \'product\',
\'posts_per_page\' => 30
);

$loo         


        
2条回答
  •  温柔的废话
    2021-01-23 16:47

       
      'product', 'posts_per_page' => 4, 'paged' => $paged ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) { while ( $loop->have_posts() ) : $loop->the_post(); woocommerce_get_template_part( 'content', 'product' ); endwhile; } else { echo __( 'No products found' ); } ?>

    Reference : Pagination in WooCommerce

提交回复
热议问题