0

您好,我将 function.php 更改为

/**
 * Change number of products that are displayed per page (shop page)
 */
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;
}

现在我的商店没有在商店页面中显示商品商店现在我想恢复默认值,我删除了我的 function.php 中的行,但仍然无法正常工作。我必须添加哪个过滤器才能返回?

4

1 回答 1

0

你可以试试这个

/**
  * WC: change products per page
  * @return int
  */
function so22835795_loop_shop_per_page() {
    return -1; //return any number, -1 === show all
};
add_filter('loop_shop_per_page', 'so22835795_loop_shop_per_page', 10, 0);
于 2021-02-05T12:49:38.027 回答