Skip to content

Instantly share code, notes, and snippets.

@pelmered
Last active August 29, 2015 14:03
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 pelmered/338a70515e7bb0208673 to your computer and use it in GitHub Desktop.
Save pelmered/338a70515e7bb0208673 to your computer and use it in GitHub Desktop.
WooComemrce: Change number or products
//Set products per row
add_filter( 'loop_shop_columns', create_function( '$cols', 'return 3;' ), 20 );
//Set products per page
add_filter( 'loop_shop_per_page', create_function( '$num', 'return 12;' ), 20 );
@pelmered
Copy link
Author

Two ways to use this:

  1. Create a plugin (recomended since it won't be overwritten if you update your theme):
    Copy the code above and save it into a new file in the folder wp-content/plugins/. You can call the file what ever you want, but it's good if the filename describes the purpuse of the file, for example: WooCommerce-custom-column-count.php
  2. Edit functions.php in your theme:
    Copy + Paste the code above into functions.php in your theme.

Change the return value(3) to the value you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment