Created
May 30, 2017 16:56
-
-
Save anonymous/2f9bedb4a12cc764c09e50cac0a1964c to your computer and use it in GitHub Desktop.
Change the number of products per row in WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Change number or products per row to 3 | |
add_filter('loop_shop_columns', 'loop_columns'); | |
if (!function_exists('loop_columns')) { | |
function loop_columns() { | |
return 3; // 3 products per row | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.woocommerce ul.products li.product { | |
width: calc( ( 100% - ( 30px * ( 3 - 1 ) ) ) / 3 ); | |
float: left; | |
margin-right: 30px; | |
} | |
.woocommerce ul.products li.product:nth-child(3n+3) { | |
margin-right: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment