Last active
May 2, 2021 01:20
-
-
Save stuartduff/95e7c786b59aafc0d6b5 to your computer and use it in GitHub Desktop.
Display All Product Categories on Storefront homepage
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
/** | |
* Alters the output of the homepage product categories on the Storefront theme | |
* Affects the storefront_product_categories_args filter in /inc/storefront-template-functions.php | |
*/ | |
function sd_display_all_home_product_categories( $args ) { | |
// Sets the maximum product categories to 50, you can increase this to display more if need be. | |
$args['limit'] = 50; | |
// Displays the child categories in the output as by default only parent categories display. | |
$args['child_categories'] = ''; | |
// Output | |
return $args; | |
} | |
add_filter( 'storefront_product_categories_args', 'sd_display_all_home_product_categories' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment