Make WordPress Core


Ignore:
Timestamp:
11/24/2011 05:44:53 PM (13 years ago)
Author:
azaozz
Message:

Move the check whether the theme supports widgets before we register any extra sidebars, fixes #19352

File:
1 edited

Legend:

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

    r19445 r19449  
    6464);
    6565
     66if ( empty($wp_registered_sidebars) ) {
     67    // the theme has no sidebars, die.
     68    require_once( './admin-header.php' );
     69?>
     70
     71    <div class="wrap">
     72    <?php screen_icon(); ?>
     73    <h2><?php echo esc_html( $title ); ?></h2>
     74        <div class="error">
     75            <p><?php _e( 'No Sidebars Defined' ); ?></p>
     76        </div>
     77        <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>
     78    </div>
     79
     80<?php
     81    require_once( './admin-footer.php' );
     82    exit;
     83}
     84
    6685// These are the widgets grouped by sidebar
    6786$sidebars_widgets = wp_get_sidebars_widgets();
     
    105124
    106125retrieve_widgets();
    107 
    108 if ( count($wp_registered_sidebars) == 1 ) {
    109     // If only "wp_inactive_widgets" is defined the theme has no sidebars, die.
    110     require_once( './admin-header.php' );
    111 ?>
    112 
    113     <div class="wrap">
    114     <?php screen_icon(); ?>
    115     <h2><?php echo esc_html( $title ); ?></h2>
    116         <div class="error">
    117             <p><?php _e( 'No Sidebars Defined' ); ?></p>
    118         </div>
    119         <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>
    120     </div>
    121 
    122 <?php
    123     require_once( './admin-footer.php' );
    124     exit;
    125 }
    126126
    127127// We're saving a widget without js
Note: See TracChangeset for help on using the changeset viewer.