diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php
index 31123f6cdf..7bbf1e8401 100644
--- a/wp-admin/nav-menus.php
+++ b/wp-admin/nav-menus.php
@@ -482,7 +482,18 @@ require_once( 'admin-header.php' );
-
+
+
+
diff --git a/wp-content/themes/twentyten/functions.php b/wp-content/themes/twentyten/functions.php
index 06b44d0ea5..67bb4edd02 100644
--- a/wp-content/themes/twentyten/functions.php
+++ b/wp-content/themes/twentyten/functions.php
@@ -80,7 +80,7 @@ function twentyten_setup() {
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu()
- add_theme_support( 'nav-menus' );
+ register_nav_menus( array('main' => __('Main Menu')) );
// Add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );
diff --git a/wp-content/themes/twentyten/header.php b/wp-content/themes/twentyten/header.php
index 97f743e238..c789ddc747 100644
--- a/wp-content/themes/twentyten/header.php
+++ b/wp-content/themes/twentyten/header.php
@@ -69,7 +69,7 @@
- 'menu_order', 'container_class' => 'menu-header' ) ); ?>
+ 'menu_order', 'container_class' => 'menu-header', 'theme_menu' => 'main' ) ); ?>
diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php
index 52cefa243c..f73e90c603 100644
--- a/wp-includes/nav-menu-template.php
+++ b/wp-includes/nav-menu-template.php
@@ -193,7 +193,7 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
function wp_nav_menu( $args = array() ) {
$defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'menu_class' => 'menu', 'echo' => true,
'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '',
- 'depth' => 0, 'walker' => '', 'context' => 'frontend' );
+ 'depth' => 0, 'walker' => '', 'context' => 'frontend', 'theme_menu' => '' );
$args = wp_parse_args( $args, $defaults );
$args = apply_filters( 'wp_nav_menu_args', $args );
@@ -202,6 +202,12 @@ function wp_nav_menu( $args = array() ) {
// Get the nav menu
$menu = wp_get_nav_menu_object( $args->menu );
+ if ( ! $menu && $slot ) {
+ $slots = get_nav_menu_slots();
+ if ( isset($slots) && isset($slots['theme_menu']) )
+ $menu = wp_get_nav_menu_object( $slots['theme_menu'] );
+ }
+
// If we couldn't find a menu based off the menu argument
// get the first menu that has items.
if ( ! $menu ) {
diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php
index c087f3ff3c..2a6cdd9e28 100644
--- a/wp-includes/nav-menu.php
+++ b/wp-includes/nav-menu.php
@@ -61,6 +61,31 @@ function is_nav_menu( $menu ) {
return false;
}
+/**
+ * Register nav menus for a theme.
+ *
+ * @since 3.0.0
+ *
+ * @param array Associative array of menu slot identifiers and descriptions.
+ */
+function register_nav_menus( $menus = array() ) {
+ global $_wp_registered_nav_menus;
+
+ add_theme_support( 'nav-menus' );
+
+ $_wp_registered_nav_menus = $menus;
+}
+
+function get_registered_nav_menus() {
+ global $_wp_registered_nav_menus;
+
+ return $_wp_registered_nav_menus;
+}
+
+function get_nav_menu_slots() {
+ return get_theme_mod('nav_menu_slots');
+}
+
/**
* Determine whether the given ID is a nav menu item.
*