Skip to content

Instantly share code, notes, and snippets.

@pavelrich
Last active October 22, 2021 00:12
Show Gist options
  • Save pavelrich/c7878d919178e85fffba2b93c704d439 to your computer and use it in GitHub Desktop.
Save pavelrich/c7878d919178e85fffba2b93c704d439 to your computer and use it in GitHub Desktop.
Muse WordPress Theme — [muse-section section="SECTION"] Shortcode to Display the Section
<?php
if ( ! function_exists( 'muse_shortcode_section' ) ) {
/**
* [muse-section section="SECTION"] Shortcode to Display the Section
*
* @param $attrs
*
* @return false|string
*/
function muse_shortcode_section( $attrs ) {
$attrs = shortcode_atts( array(
'section' => 'about', // about | albums | events | galleries | posts | products-featured | products-recent
), $attrs );
ob_start();
get_template_part( 'templates/section', esc_attr( $attrs['section'] ) );
return ob_get_clean();
}
add_shortcode( 'muse-section', 'muse_shortcode_section' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment