Skip to content

Instantly share code, notes, and snippets.

@guillermorangel
Created August 5, 2013 21:27
Show Gist options
  • Save guillermorangel/6159765 to your computer and use it in GitHub Desktop.
Save guillermorangel/6159765 to your computer and use it in GitHub Desktop.
<?php
add_action( 'init', 'my_custom_menus' );
function my_custom_menus() {
register_nav_menus(
array(
'primary-menu' => __( 'Primary Menu' ),
'secondary-menu' => __( 'Secondary Menu' ),
'footer-left' => __( 'Footer Left' ),
'footer-right' => __( 'Footer Right' ),
'sitemap' => __( 'Sitemap' )
)
);
}
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');
?>
[menu name="sitemap"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment