The WordPress function wp_nav_menu () is used to display the navigation menu at the header, title, and bottom. The background settings are located in: appearance => menu. Currently, three menu options are supported.
Function instructions:
<?php $defaults = array( ‘theme_location‘ => ‘‘,> ‘menu‘ => ‘‘, ‘container‘ => ‘div‘, ‘container_class‘ => ‘menu-{menu slug}-container‘, ‘container_id‘ => ‘‘, ‘menu_class‘ => ‘menu‘, ‘menu_id‘ => ‘‘, ‘echo‘ => true, ‘fallback_cb‘ => ‘wp_page_menu‘, ‘before‘ => ‘‘, ‘after‘ => ‘‘, ‘link_before‘ => ‘‘, ‘link_after‘ => ‘‘, ‘items_wrap‘ => ‘<ul id="%1$s" class="%2$s">%3$s</ul>‘, ‘depth‘ => 0, ‘walker‘ => ‘‘); ?><?php wp_nav_menu( $defaults ); ?>
Function parameter description:
Wp_nav_menu (Array ('Theme _ location' => 'primary'); // call the first menu.
$ Theme_locaton: (string) (optional)
Default Value: None
It is used to specify a registered navigation menu name when calling the navigation menu. If it is not specified, the first menu name is displayed.
$ Menu: (string) (optional)
Default Value: None
Use the name of the navigation menu to call the menu, which can be ID, slug, and name (matched in order ).
$ Container: (string) (optional)
Default Value: div
The label type of the UL parent node (the container of the navigation menu here). Only the DIV and NAV labels are supported. If it is another value, the label of the UL parent node will not be displayed. You can also use false (Container => false) to remove the UL parent node label.
$ Container_class: (string) (optional)
Default Value: menu-{menu slug}-container
The Class Attribute Value of the UL parent node.
$ Container_id: (string) (optional)
Default Value: None
Id attribute value of the UL parent node.
$ Menu_class: (string) (optional)
Default Value: Menu
The Class Attribute Value of the UL node.
$ Menu_id: (string) (optional)
Default Value: menu slug, auto-Increment
Id attribute value of the UL node.
$ ECHO: (Boolean) (optional)
Default Value: true (direct display)
Are you sure you want to directly display the navigation menu or return HTML clips? If you want to use the navigation code as a value assignment, you can set it to false.
$ Fallback_cb: (string) (optional)
Default Value: wp_page_menu (display page list as menu)
This is a callback function that is not called when navigation is not set in the background.
$ Before: (string) (optional)
Default Value: None
The text displayed before each menu link.
$ After :( string) (optional)
Default Value: None
The text displayed after each menu link.
$ Link_before: (string) (optional)
Default Value: None
The text displayed before the link text of each menu.
$ Link_after :( string) (optional)
Default Value: None
The text displayed after each menu link text.
$ Items_wrap: (string) (optional)
Default Value: None
Replace the modified ul class with a string.
$ Depth: (integer) (optional)
Default Value: 0
Displays the menu depth. When the value is 0, all menus of depth are displayed.
$ Walker: (Object Type) (optional)
Default Value: New walker_nav_menu
A custom traversal object that calls an object definition display navigation menu.
Wp_nav_menu instance
Background settings:
Log on to the background settings: appearance =, and set three menus: Nav, menu, and footer.
Add the "page" option or "category" option to the specified page and save it.
Page call:
// This function is located in the functions under the topic. PHP // code from: http://www.mangostuido.net//?type=nav, menu, footerfunction mgmenu ($ type) {wp_nav_menu (Array ('Theme _ location' => $ type, 'echo '=> false ));}
Address: http://www.mangostudio.net/archives/132
WordPress function: wp_nav_menu ($ ARGs) Function Description