WooCommerce 怎样控制或修改每页显示的产品的数量? – WooCommerce教程

WooCommerce 怎样控制或修改每页显示的产品的数量? – WooCommerce教程

目录

add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );

function new_loop_shop_per_page( $cols ) {
  // $cols contains the current number of products per page based on the value stored on Options -> Reading
  // Return the number of products you wanna show per page.
  $cols = 9;
  return $cols;
}

首先,点击左上角的 “自定义主题”,使用上面代码:

把上面代码加入你主题的functions.php的结尾,那个 “9” 可以改成任意你想要的数量。

 

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

联系我们