Skip to content

Instantly share code, notes, and snippets.

@simonlk
Created July 28, 2014 23:54
Show Gist options
  • Save simonlk/ea6bb3b4a10cc526f834 to your computer and use it in GitHub Desktop.
Save simonlk/ea6bb3b4a10cc526f834 to your computer and use it in GitHub Desktop.
Create menu shortcode
/*==================================================
Create menu shortcodes - [menu name="menu-name"]
================================================= */
function sk_menu_content_shortcode( $atts, $content = null ) {
extract( shortcode_atts(array( 'name' => null, ), $atts ) );
return wp_nav_menu( array( 'menu' => $name, 'echo' => false ) );
}
add_shortcode( 'menu', 'sk_menu_content_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment