Last active
March 10, 2020 15:36
Star
You must be signed in to star a gist
[Theming Snippets][Change number of products per row for non Woo-developed themes]
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', 999); | |
if (!function_exists('loop_columns')) { | |
function loop_columns() { | |
return 3; // 3 products per row | |
} | |
} |
Missing an end bracket as stated above.
Updated, thanks!
Thanks for snippet, under which license is it under - GPLv3 like WooCommerce?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this snippet however, based on my testing, you're missing a closing curly bracket. Also, i question your use of
!function_exists('loop_columns')
. I don't see this as necessary unless you're checking the original function in WooCommerce and its also named loop_columns. Based on my search in woocommerce there is none. Also, i wouldn't use it in that position in the function anyway. I suggest the use of this code https://gist.github.com/woogists/3894598a086c4e265facc16fed0b9c10#file-wc-change-number-of-products-row-wootheme-php