Skip to content

Instantly share code, notes, and snippets.

@jerewall
Created February 18, 2015 21:02
Show Gist options
  • Save jerewall/9e454f834e7ecfda6f92 to your computer and use it in GitHub Desktop.
Save jerewall/9e454f834e7ecfda6f92 to your computer and use it in GitHub Desktop.
Sitemap for Menu
<h1>Sitemap</h1>
[menu name="Sitemap"]
/* Create shortcode to generate menu list in post */
/* Shortcode: [menu name="name-of-menu"] */
function print_menu_shortcode($atts, $content = null) {
extract(shortcode_atts(array( 'name' => null, ), $atts));
return wp_nav_menu( array( 'menu' => $name, 'echo' => false ) );
}
add_shortcode('menu', 'print_menu_shortcode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment