Skip to content

Instantly share code, notes, and snippets.

@mmh4560
Last active September 18, 2020 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmh4560/24c2e61efa6f63668dcb2d8fde5094f4 to your computer and use it in GitHub Desktop.
Save mmh4560/24c2e61efa6f63668dcb2d8fde5094f4 to your computer and use it in GitHub Desktop.
// Woocommerce Show All products on Shop 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 = -1;
return $cols;
}
// Woocommerce Show 4 Column in products
add_filter( 'loop_shop_columns', 'new_cl_loop_columns_per_page', 20 );
/**
* How many columns per page
* @since 1.0.0
*/
function new_cl_loop_columns_per_page( $cols ) {
// Return the number of columns you want show per page.
$cols = 4;
return $cols;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment