Make WordPress Core

Changeset 21825


Ignore:
Timestamp:
09/12/2012 02:16:46 AM (12 years ago)
Author:
nacin
Message:

Don't show Appearance > Widgets if the theme has no sidebars defined. props SergeyBiryukov for the initial patch. fixes #21761.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/widgets.php

    r21577 r21825  
    6969);
    7070
    71 if ( empty($wp_registered_sidebars) ) {
    72     // the theme has no sidebars, die.
    73     require_once( './admin-header.php' );
    74 ?>
    75 
    76     <div class="wrap">
    77     <?php screen_icon(); ?>
    78     <h2><?php echo esc_html( $title ); ?></h2>
    79         <div class="error">
    80             <p><?php _e( 'No Sidebars Defined' ); ?></p>
    81         </div>
    82         <p><?php _e( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="http://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.' ); ?></p>
    83     </div>
    84 
    85 <?php
    86     require_once( './admin-footer.php' );
    87     exit;
     71if ( ! current_theme_supports( 'widgets' ) ) {
     72    wp_die( __( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="http://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.' ) );
    8873}
    8974
  • trunk/wp-includes/functions.php

    r21823 r21825  
    25502550function wp_widgets_add_menu() {
    25512551    global $submenu;
     2552
     2553    if ( ! current_theme_supports( 'widgets' ) )
     2554        return;
     2555
    25522556    $submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );
    25532557    ksort( $submenu['themes.php'], SORT_NUMERIC );
Note: See TracChangeset for help on using the changeset viewer.