Skip to content

Instantly share code, notes, and snippets.

@BFTrick
Last active July 19, 2017 18:58
Show Gist options
  • Save BFTrick/968a192bf54627965146636159aefbe2 to your computer and use it in GitHub Desktop.
Save BFTrick/968a192bf54627965146636159aefbe2 to your computer and use it in GitHub Desktop.
WooCommerce change the number of products per row. You still have to write CSS so each of the products fit in there.
<?php
// change the number of products per row
add_filter( 'loop_shop_columns', 'patricks_loop_columns', 20 );
function patricks_loop_columns() {
return 5; // the number of products per row
}
// you still need to add CSS to make it look right. In Storefront you can add this to your style.css file.
// @media (min-width:768px){
// .products .product {
// max-width: 15%;
// }
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment