WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/register nav menus

Description

Registers multiple custom navigation menus in the new custom menu editor of WordPress 3.0. This allows for the creation of custom menus in the dashboard for use in your theme.

See register_nav_menu() for creating a single menu, and Navigation Menus for adding theme support.

Usage

 <?php register_nav_menus$locations ); ?> 

Parameters

$locations
(array) (required) An associative array of menu location slugs (key) and descriptions (according value).
Default: None

Return Values

None.

Examples

add_action( 'after_setup_theme', 'register_custom_nav_menus' );
function register_custom_nav_menus() {
	register_nav_menus( array(
		'pluginbuddy_mobile' => 'PluginBuddy Mobile Navigation Menu',
		'footer_menu' => 'My Custom Footer Menu',
	) );
}

Notes

  • This function automatically registers custom menu support for the theme, therefore you do not need to call add_theme_support( 'menus' );
  • Use wp_nav_menu() to display your custom menu.
  • On the Menus admin page, there is a Show advanced menu properties to allow "Link Target" "CSS Classes" "Link Relationship (XFN) Description"
  • Use get_registered_nav_menus to get back a list of the menus that have been registered in a theme.

Change Log

Source File

Resources

Related

Navigation Menu

See also index of Function Reference and index of Template Tags.