Created
September 14, 2018 03:55
-
-
Save WordBits/2f937646260116f8b5ee7b7f10c2d8e9 to your computer and use it in GitHub Desktop.
Displays a WordPress navigation menu as a simple bullet point list. Useful for automating a sitemap page or injecting into the footer. Usage: [rtpmenu name="somemenuname"]
[rtpmenu name="somemenuname" menu_class="acustomclassforstyling"]
This file contains hidden or 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 | |
// Download this snippet as a plugin and more at: https://wordbits.io/snippet/rtp-theme-cleaner/ | |
// Created by: Matthew Harris | |
?> | |
<?php | |
function rtp_menu_shortcode($atts, $content = null) { | |
extract(shortcode_atts(array( 'menu' => null, 'menu_class' => 'rtpmenushortcode' ), $atts)); | |
return wp_nav_menu( | |
array( | |
'menu_class' => $menu_class, | |
'menu' => $menu, | |
'echo' => false | |
) | |
); | |
} | |
add_shortcode('rtpmenu', 'rtp_menu_shortcode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment