Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stuartduff/944aca59bf8f7a3744e23ecd809d7c77 to your computer and use it in GitHub Desktop.
Save stuartduff/944aca59bf8f7a3744e23ecd809d7c77 to your computer and use it in GitHub Desktop.
Storefront display four product categories on the homepage.
/**
* Alters the output of the homepage product categories on the Storefront theme
* Affects the storefront_product_categories_args filter in /inc/structure/template-tags.php
*/
function sd_display_four_home_product_categories( $args ) {
// Sets the maximum product categories to 4, you can increase this to display more if need be.
$args['limit'] = 4;
// Displays the number of columns as 4 instead of the default 3.
$args['columns'] = 4;
// Output
return $args;
}
add_filter( 'storefront_product_categories_args', 'sd_display_four_home_product_categories' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment