WordPress.org

Make WordPress Core

Changeset 15193


Ignore:
Timestamp:
06/10/2010 05:57:30 PM (9 years ago)
Author:
nacin
Message:

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

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/nav-menu.php

    r15191 r15193  
    366366function wp_nav_menu_setup() {
    367367    // Register meta boxes
    368     if ( ( current_theme_supports( 'widgets' ) || get_registered_nav_menus() ) && wp_get_nav_menus() )
     368    if ( wp_get_nav_menus() )
    369369        add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' );
    370370    add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
     
    461461function wp_nav_menu_locations_meta_box() {
    462462    global $nav_menu_selected_id;
    463     $locations = get_registered_nav_menus();
    464 
    465     if ( empty( $locations ) ) {
     463
     464    if ( ! current_theme_supports( 'menus' ) ) {
    466465        // We must only support widgets. Leave a message and bail.
    467466        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>';
     
    469468    }
    470469
     470    $locations = get_registered_nav_menus();
    471471    $menus = wp_get_nav_menus();
    472472    $menu_locations = get_nav_menu_locations();
  • trunk/wp-admin/menu.php

    r14953 r15193  
    158158    $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
    159159        $submenu['themes.php'][5]  = array(__('Themes'), 'switch_themes', 'themes.php');
    160         if ( current_theme_supports( 'nav-menus' ) || current_theme_supports( 'widgets' ) )
     160        if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
    161161            $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
    162162} else {
    163163    $menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
    164164        $submenu['themes.php'][5]  = array(__('Themes'), 'edit_theme_options', 'themes.php');
    165         if ( current_theme_supports( 'nav-menus' ) || current_theme_supports( 'widgets' ) )
     165        if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
    166166            $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php' );
    167167}
  • trunk/wp-admin/nav-menus.php

    r15191 r15193  
    1616require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
    1717
    18 if ( ! current_theme_supports( 'nav-menus' ) && ! current_theme_supports( 'widgets' ) )
     18if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) )
    1919    wp_die( __( 'Your theme does not support navigation menus or widgets.' ) );
    2020
     
    434434wp_initial_nav_menu_meta_boxes();
    435435
    436 if ( ! get_registered_nav_menus() && ! wp_get_nav_menus() )
     436if ( ! current_theme_supports( 'menus' ) && ! wp_get_nav_menus() )
    437437    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>';
    438438
  • trunk/wp-content/themes/twentyten/functions.php

    r15120 r15193  
    6262 * functions.php file.
    6363 *
    64  * @uses add_theme_support() To add support for post thumbnails, navigation menus, and automatic feed links.
     64 * @uses add_theme_support() To add support for post thumbnails and automatic feed links.
     65 * @uses register_nav_menus() To add support for navigation menus.
    6566 * @uses add_custom_background() To add support for a custom background.
    6667 * @uses add_editor_style() To style the visual editor.
  • trunk/wp-includes/nav-menu.php

    r15116 r15193  
    7474    global $_wp_registered_nav_menus;
    7575
    76     add_theme_support( 'nav-menus' );
     76    add_theme_support( 'menus' );
    7777
    7878    $_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations );
Note: See TracChangeset for help on using the changeset viewer.