Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Theming Snippets] Change number of products displayed per page
/**
* 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;
}
@mmh4560

This comment has been minimized.

Copy link

mmh4560 commented Jan 22, 2019

If I use $cols = 12; instead of $cols = 9;.
Why It's not working in my WordPress Divi theme ??

@sreygel

This comment has been minimized.

Copy link

sreygel commented Feb 15, 2019

I have the same problem... :(

@cesarguillenf

This comment has been minimized.

Copy link

cesarguillenf commented Feb 19, 2019

same problem

@JasonS1995

This comment has been minimized.

Copy link

JasonS1995 commented Mar 1, 2019

Guys, in Divi, this snippet doesn't work, however you can easily change the number of products in the Divi Theme options on the General Tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.