Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HosseinKarami/e56af1d84353754ca2a755f7e2a87088 to your computer and use it in GitHub Desktop.
Save HosseinKarami/e56af1d84353754ca2a755f7e2a87088 to your computer and use it in GitHub Desktop.
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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment