Created
November 7, 2016 16:29
-
-
Save Netzberufler/8282726fc467df0e8e72a123e03a5830 to your computer and use it in GitHub Desktop.
Shortcode to display WordPress Menu
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
<?php | |
/** | |
* Shortcode to display a WordPress menu | |
* | |
*/ | |
function theme_slug_menu_shortcode( $atts ) { | |
// Get Shortcode Parameters. | |
$menu = shortcode_atts( array( | |
'slug' => '', | |
), $atts ); | |
// Return Custom Menu. | |
return wp_nav_menu( array( | |
'menu' => $menu['slug'], | |
'menu_class' => 'artikelserie', | |
'echo' => false, | |
'items_wrap' => '<ol id="%1$s" class="%2$s">%3$s</ol>', | |
) ); | |
} | |
add_shortcode( 'custom_menu', 'theme_slug_menu_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment