This is a Developer level doc. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our Support Policy.
functions.php
file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Avoid adding custom code directly to your parent theme’s functions.php
file as this will be wiped entirely when you update the theme.
Defines where ‘first’ and ‘last’ classes are applied in product archives.
Please be aware that some third-party themes may be coded in a way that the snippets below have no effect on layout. In this case, we recommend you contact the theme author.
Custom theme
↑ Back to top
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 | |
} | |
} |
Theme by Woo
↑ Back to topfunctions.php
file (preferably in a child theme) to overwrite the theme default.
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
/** | |
* Override theme default specification for product # per row | |
*/ | |
function loop_columns() { | |
return 5; // 5 products per row | |
} | |
add_filter('loop_shop_columns', 'loop_columns', 999); |
Shortcode
↑ Back to top[recent_products per_page="12" columns="5"]
will display the products in rows of 5 columns.