Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add a custom shortcode section to the storefront themes homepage template.
function sf_output_custom_shortcode_section() {
echo '<section class="storefront-product-section storefront-product-category">';
echo '<h2 class="section-title">' . __( 'Music Category', 'storefront' ) . '</h2>';
echo do_shortcode( '[product_category category="music" columns="4" per_page="4"]' );
echo '</section>';
}
add_action( 'homepage', 'sf_output_custom_shortcode_section', 50 );
@inakicalvo

This comment has been minimized.

Copy link

commented May 10, 2018

@stuartduff thanks a lot! This lines of code saved my day 👍

@Maksimasc

This comment has been minimized.

Copy link

commented Mar 7, 2019

Hello, can't find a homepage file location...

@davidsolsona

This comment has been minimized.

Copy link

commented May 22, 2019

Great! thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.