WordPress.org

Make WordPress Core

Ticket #8035: without_widgets.diff

File without_widgets.diff, 3.9 KB (added by scribu, 10 years ago)

If there are no sidebars defined, writes "whitout widgets"

  • wp-content/themes/default/archive.php

     
    2828                <h2 class="pagetitle">Blog Archives</h2>
    2929          <?php } ?>
    3030
    31 
    3231                <div class="navigation">
    3332                        <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    3433                        <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
  • wp-admin/includes/dashboard.php

     
    127127        wp_dashboard_trigger_widget_control( $meta_box['id'] );
    128128        echo "<p class='submit'><input type='hidden' name='widget_id' value='$meta_box[id]' /><input type='submit' value='" . __( 'Submit' ) . "' /></p>";
    129129
    130         echo '</form>'; 
     130        echo '</form>';
    131131}
    132132
    133133/**
     
    159159/* Dashboard Widgets */
    160160
    161161function wp_dashboard_right_now() {
     162        global $wp_registered_sidebars;
     163
    162164        $num_posts = wp_count_posts( 'post' );
    163165        $num_pages = wp_count_posts( 'page' );
    164166
     
    253255        echo "</tr>";
    254256        do_action('right_now_table_end');
    255257        echo "\n\t</table>\n\t</div>";
    256  
     258
    257259  echo "\n\t".'<div class="versions">';
    258260        $ct = current_theme_info();
    259261        $sidebars_widgets = wp_get_sidebars_widgets();
     
    261263        $num = number_format_i18n( $num_widgets );
    262264
    263265        echo "\n\t<p>";
    264         if ( current_user_can( 'switch_themes' ) ) {
    265                 echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
    266                 printf(__ngettext('Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $ct->title, $num);
     266        if ( $wp_registered_sidebars ) {
     267                if ( current_user_can( 'switch_themes' ) ) {
     268                        echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
     269                        printf(__ngettext('Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $ct->title, $num);
     270                } else {
     271                        printf(__ngettext('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $ct->title, $num);
     272                }
    267273        } else {
    268                 printf(__ngettext('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $ct->title, $num);
     274                if ( current_user_can( 'switch_themes' ) ) {
     275                        echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
     276                        printf('Theme <span class="b"><a href="themes.php">%1$s</a></span> without widgets', $ct->title);
     277                } else {
     278                        printf('Theme <span class="b">%1$s</span> without widgets', $ct->title);
     279                }
    269280        }
    270                
    271281        echo '</p>';
    272282
    273283        update_right_now_message();
     
    295305                                'orderby' => 'modified',
    296306                                'order' => 'DESC'
    297307                        ) );
    298                
     308
    299309                        if ( $drafts_query->posts )
    300310                                $drafts =& $drafts_query->posts;
    301311                }
     
    745755 */
    746756function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
    747757        global $wp_dashboard_control_callbacks;
    748        
     758
    749759        if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_dashboard_control_callbacks[$widget_control_id]) && is_callable($wp_dashboard_control_callbacks[$widget_control_id]) ) {
    750760                call_user_func( $wp_dashboard_control_callbacks[$widget_control_id], '', array( 'id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[$widget_control_id] ) );
    751761        }