WordPress.org

Make WordPress Core

Changeset 24217


Ignore:
Timestamp:
05/09/13 02:43:26 (11 months ago)
Author:
SergeyBiryukov
Message:

Don't show "Manage Locations" tab if the theme has no menu locations defined. props DrewAPicture. fixes #24115.

File:
1 edited

Legend:

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

    r24214 r24217  
    352352        break; 
    353353    case 'locations': 
     354        if ( ! $num_locations ) { 
     355            wp_redirect( admin_url( 'nav-menus.php' ) ); 
     356            exit(); 
     357        } 
     358 
    354359        add_filter( 'screen_options_show_screen', '__return_false' ); 
    355360 
     
    467472wp_initial_nav_menu_meta_boxes(); 
    468473 
    469 if ( ! current_theme_supports( 'menus' ) && ! wp_get_nav_menus() ) 
     474if ( ! current_theme_supports( 'menus' ) && ! $num_locations ) 
    470475    $messages[] = '<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>'; 
    471476 
     
    533538    <h2 class="nav-tab-wrapper"> 
    534539        <a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' != $_GET['action'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Edit Menus' ); ?></a> 
    535         <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( $locations_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a> 
     540        <?php if ( $num_locations && $menu_count ) : ?> 
     541            <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( $locations_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a> 
     542        <?php endif; ?> 
    536543    </h2> 
    537544    <?php 
Note: See TracChangeset for help on using the changeset viewer.