Skip to content

Instantly share code, notes, and snippets.

Created May 14, 2014 13:40
Show Gist options
  • Save anonymous/2f36dbfb0b6b556e509b to your computer and use it in GitHub Desktop.
Save anonymous/2f36dbfb0b6b556e509b to your computer and use it in GitHub Desktop.
Shortcode for adding a menu (wp_nav_menu) with the included name. e.g. [include_menu]Menu Name[/include_menu]
function menu_shortcode( $atts, $content = null ) {
return wp_nav_menu( array( 'items_wrap' => '<h3>' . $content . '</h3><ul id="%1$s" class="%2$s">%3$s</ul>', 'menu'=> $content ) );
}
add_shortcode( 'include_menu', 'menu_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment