Make WordPress Core


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.

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.