Created
November 25, 2014 09:46
-
-
Save lmartins/aa7bcb775788c9e4aa8a to your computer and use it in GitHub Desktop.
Call wordpress menus with Shortcode via menu slug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* MENU SHORTCODE | |
* Display any menu using the menu slug | |
*/ | |
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