WordPress.org

Make WordPress Core

Changeset 13810


Ignore:
Timestamp:
03/24/2010 06:35:31 PM (8 years ago)
Author:
ryan
Message:

Enable nav menu admin if theme supports widgets. Show notice if theme supports widgets but not nav-menus. see #11817

Location:
trunk
Files:
2 edited

Legend:

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

    r13802 r13810  
    7575        // Add Menu
    7676        if ( isset($_POST['create-menu-button']) ) {
    77             if ( current_theme_supports('nav-menus') ) {
     77            if ( current_theme_supports('nav-menus') || current_theme_supports('widgets') ) {
    7878                $add_nav_menu = esc_html( $_POST['create-menu-name'] );
    7979
     
    215215if ( !is_nav_menu( $nav_menu_selected_id ) ) {
    216216    $messages_div = '<div id="message" class="updated"><p>' . __('You do not have any menus. Create a new menu.') . '</p></div>';
    217    
     217
    218218// The theme supports menus
    219219} elseif ( current_theme_supports('nav-menus') ) {
    220    
    221220    // Register nav menu metaboxes
    222221    add_meta_box( 'manage-menu', __( 'Menu Settings' ), 'wp_nav_menu_manage_menu_metabox', 'nav-menus', 'side', 'high', array( $nav_menu_selected_id, $nav_menu_selected_title ) );
    223222    wp_nav_menu_metaboxes_setup();
    224223
    225 // The theme does not support menus
     224// The theme does not support menus but supports widgets
     225} elseif ( current_theme_supports('widgets') ) {
     226    // Register nav menu metaboxes
     227    add_meta_box( 'manage-menu', __( 'Menu Settings' ), 'wp_nav_menu_manage_menu_metabox', 'nav-menus', 'side', 'high', array( $nav_menu_selected_id, $nav_menu_selected_title ) );
     228    wp_nav_menu_metaboxes_setup();
     229    $messages_div = '<div id="message" class="error"><p>' . __('The current theme does not natively support menus, but you can use the &#8220;Navigation Menu&#8221; widget to add any menus you create here to the theme&#8217;s sidebar.') . '</p></div>';
     230
     231// The theme supports neither menus nor widgets.
    226232} else {
    227233    remove_meta_box( 'create-menu', 'nav-menus', 'side' );
     
    238244    <div class="hide-if-js error"><p><?php _e('You do not have JavaScript enabled in your browser. Please enable it to access the Menus functionality.'); ?></p></div>
    239245
    240     <?php if ( !empty($nav_menus) && count($nav_menus) > 1 && current_theme_supports('nav-menus') ) : ?>
     246    <?php if ( !empty($nav_menus) && count($nav_menus) > 1 && ( current_theme_supports('nav-menus') || current_theme_supports('widgets') ) ) : ?>
    241247    <ul class="subsubsub">
    242248        <?php
     
    264270            <div id="post-body">
    265271                <div id="post-body-content">
    266                     <?php if ( is_nav_menu($nav_menu_selected_id) && current_theme_supports('nav-menus') ) : ?>
     272                    <?php if ( is_nav_menu($nav_menu_selected_id) && ( current_theme_supports('nav-menus') || current_theme_supports('widgets') ) ) : ?>
    267273                        <div id="menu-container" class="postbox">
    268274                            <h3 class="hndle"><?php echo esc_html( $nav_menu_selected_title ); ?></h3>
  • trunk/wp-includes/widgets.php

    r13770 r13810  
    563563    $wp_registered_sidebars[$sidebar['id']] = $sidebar;
    564564
     565    add_theme_support('widgets');
     566
    565567    return $sidebar['id'];
    566568}
Note: See TracChangeset for help on using the changeset viewer.