The register_nav_menus() function is used to register a menu. The menu refers to the menu manager of WordPress 3.0+. After registration, the user can drag in the menu manager to generate the navigation menu.
usage
1
|
register_nav_menus
(
$locations
)
;
|
parameter
$locations
(array) (required) The menu to be registered, the key value is the menu ID, the key name is the menu name, and multiple can be created at one time.
Default: None
return value
This function has no return value.
example
1
2
3
4
5
6
7
8
9
10
11
|
/**
*建立菜单
*http://www.endskin.com/register_nav_menus/
*/
function
Bing_register_nav_menus
(
)
{
register_nav_menus
(
array
(
'header_menu'
=
>
__
(
'顶部菜单'
,
'Bing'
)
,
'footer_menu'
=
>
__
(
'页脚菜单'
,
'Bing'
)
)
)
;
}
add_action
(
'init'
,
'Bing_register_nav_menus'
)
;
|
other
The function is located in: wp-includes/nav-menu.php
More articles about this function: http://www.endskin.com/tag/menu