Switch to current_theme_supports(menus) internally. Adding theme support for 'nav-menus' is deprecated in favor of register_nav_menu(s). fixes #13825.

git-svn-id: http://svn.automattic.com/wordpress/trunk@15193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-06-10 17:57:30 +00:00
parent 1e732357a2
commit e13e6254dc
5 changed files with 10 additions and 9 deletions

View File

@ -365,7 +365,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
**/
function wp_nav_menu_setup() {
// Register meta boxes
if ( ( current_theme_supports( 'widgets' ) || get_registered_nav_menus() ) && wp_get_nav_menus() )
if ( wp_get_nav_menus() )
add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' );
add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
wp_nav_menu_post_type_meta_boxes();
@ -460,14 +460,14 @@ function wp_nav_menu_taxonomy_meta_boxes() {
*/
function wp_nav_menu_locations_meta_box() {
global $nav_menu_selected_id;
$locations = get_registered_nav_menus();
if ( empty( $locations ) ) {
if ( ! current_theme_supports( 'menus' ) ) {
// We must only support widgets. Leave a message and bail.
echo '<p class="howto">' . __('The current theme does not natively support menus, but you can use the &#8220;Custom Menu&#8221; widget to add any menus you create here to the theme&#8217;s sidebar.') . '</p>';
return;
}
$locations = get_registered_nav_menus();
$menus = wp_get_nav_menus();
$menu_locations = get_nav_menu_locations();
$num_locations = count( array_keys($locations) );

View File

@ -157,12 +157,12 @@ $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
if ( current_user_can( 'switch_themes') ) {
$menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
$submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
if ( current_theme_supports( 'nav-menus' ) || current_theme_supports( 'widgets' ) )
if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
$submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
} else {
$menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
$submenu['themes.php'][5] = array(__('Themes'), 'edit_theme_options', 'themes.php');
if ( current_theme_supports( 'nav-menus' ) || current_theme_supports( 'widgets' ) )
if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
$submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php' );
}

View File

@ -15,7 +15,7 @@ require_once( 'admin.php' );
// Load all the nav menu interface functions
require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
if ( ! current_theme_supports( 'nav-menus' ) && ! current_theme_supports( 'widgets' ) )
if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) )
wp_die( __( 'Your theme does not support navigation menus or widgets.' ) );
// Permissions Check
@ -433,7 +433,7 @@ foreach( (array) $nav_menus as $key => $_nav_menu ) {
wp_nav_menu_setup();
wp_initial_nav_menu_meta_boxes();
if ( ! get_registered_nav_menus() && ! wp_get_nav_menus() )
if ( ! current_theme_supports( 'menus' ) && ! wp_get_nav_menus() )
echo '<div id="message" class="updated"><p>' . __('The current theme does not natively support menus, but you can use the &#8220;Custom Menu&#8221; widget to add any menus you create here to the theme&#8217;s sidebar.') . '</p></div>';
$help = '<p>' . __('This feature is new in version 3.0; to use a custom menu in place of your theme&#8217;s default menus, support for this feature must be registered in the theme&#8217;s functions.php file. If your theme does not support the custom menus feature yet (the new default theme, Twenty Ten, does), you can learn about adding support yourself by following the below link.') . '</p>';

View File

@ -61,7 +61,8 @@ if ( ! function_exists( 'twentyten_setup' ) ):
* To override twentyten_setup() in a child theme, add your own twentyten_setup to your child theme's
* functions.php file.
*
* @uses add_theme_support() To add support for post thumbnails, navigation menus, and automatic feed links.
* @uses add_theme_support() To add support for post thumbnails and automatic feed links.
* @uses register_nav_menus() To add support for navigation menus.
* @uses add_custom_background() To add support for a custom background.
* @uses add_editor_style() To style the visual editor.
* @uses load_theme_textdomain() For translation/localization support.

View File

@ -73,7 +73,7 @@ function is_nav_menu( $menu ) {
function register_nav_menus( $locations = array() ) {
global $_wp_registered_nav_menus;
add_theme_support( 'nav-menus' );
add_theme_support( 'menus' );
$_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations );
}