How do I add a WordPress menu to the content of my page?

=========
QUESTION
———
How do I put a WordPress menu into the content of a WordPress page?

How do I call a navigation menu using a short code?

How do I add a navigation or site map to all sub pages on my page?

 

=========
ANSWER
———
First setup a menu in WordPress under Appearance, Menus

Then add the following code to your your theme’s FUNCTIONS.PHP file – no difference on where in the file you add it.
(Appearance, Editor, click the Functions.php file on the right)

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');

 

After adding the code to your FUNCTIONS.PHP file, place the following shortcode in your page content

[menu name="main-menu"]

Replacing the name in quotes with your menu’s name

———
Another option:
Plugin: Sub Page Navigation Widget

 

=========
EXAMPLES
———
See ANSWER

 

=========
APPLIES TO / KEY WORDS
———
WordPress
Navigation
Menu
Links
Site Map
Sitemap

 

=========
REF
———
Huge thanks to SillyBean.net for this one!
http://sillybean.net/2010/07/call-a-navigation-menu-using-a-shortcode/

 


http://www.anysitesupport.com/how-do-i-add-a-wordpress-menu-to-the-content-of-my-page/
http://anySiteHosting.com


By | 2017-12-01T23:47:49+00:00 May 4th, 2011|Documentation, Internet/Web, WordPress|0 Comments