mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
First pass on 'Theme Locations' for navigation menus. Themes need to specify a location when calling wp_nav_menu and register locations in functions.php. Users then map menus to locations in the nav menu admin. Subject to review. see #13378.
git-svn-id: https://develop.svn.wordpress.org/trunk@14620 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -66,24 +66,34 @@ function is_nav_menu( $menu ) {
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param array Associative array of menu slot identifiers and descriptions.
|
||||
* @param array $locations Associative array of menu location identifiers (like a slug) and descriptive text.
|
||||
*/
|
||||
function register_nav_menus( $menus = array() ) {
|
||||
function register_nav_menus( $locations = array() ) {
|
||||
global $_wp_registered_nav_menus;
|
||||
|
||||
add_theme_support( 'nav-menus' );
|
||||
|
||||
$_wp_registered_nav_menus = $menus;
|
||||
$_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register nav menu for a theme.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $location Menu location identifier, like a slug.
|
||||
* @param string $description Menu location descriptive text.
|
||||
*/
|
||||
function register_nav_menu( $location, $description ) {
|
||||
register_nav_menus( array( $location => $description ) );
|
||||
}
|
||||
|
||||
function get_registered_nav_menus() {
|
||||
global $_wp_registered_nav_menus;
|
||||
|
||||
return $_wp_registered_nav_menus;
|
||||
return $GLOBALS['_wp_registered_nav_menus'];
|
||||
}
|
||||
|
||||
function get_nav_menu_slots() {
|
||||
return get_theme_mod('nav_menu_slots');
|
||||
function get_nav_menu_locations() {
|
||||
return get_theme_mod('nav_menu_locations');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user