diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 4f5d0c399a..7a6cd5204e 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -194,6 +194,8 @@ function wp_dashboard() { /* Dashboard Widgets */ function wp_dashboard_right_now() { + global $wp_registered_sidebars; + $num_posts = wp_count_posts( 'post' ); $num_pages = wp_count_posts( 'page' ); @@ -315,18 +317,33 @@ function wp_dashboard_right_now() { echo "\n\t".'
"; - if ( current_user_can( 'switch_themes' ) ) { - echo '' . __('Change Theme') . ''; - printf(_n('Theme %1$s with %2$s Widget', 'Theme %1$s with %2$s Widgets', $num_widgets), $ct->title, $num); - } else { - printf(_n('Theme %1$s with %2$s Widget', 'Theme %1$s with %2$s Widgets', $num_widgets), $ct->title, $num); - } + if ( !empty($wp_registered_sidebars) ) { + $sidebars_widgets = wp_get_sidebars_widgets(); + $num_widgets = 0; + foreach ( (array) $sidebars_widgets as $k => $v ) { + if ( 'wp_inactive_widgets' == $k ) + continue; + if ( is_array($v) ) + $num_widgets = $num_widgets + count($v); + } + $num = number_format_i18n( $num_widgets ); + if ( current_user_can( 'switch_themes' ) ) { + echo '' . __('Change Theme') . ''; + printf(_n('Theme %1$s with %2$s Widget', 'Theme %1$s with %2$s Widgets', $num_widgets), $ct->title, $num); + } else { + printf(_n('Theme %1$s with %2$s Widget', 'Theme %1$s with %2$s Widgets', $num_widgets), $ct->title, $num); + } + } else { + if ( current_user_can( 'switch_themes' ) ) { + echo '' . __('Change Theme') . ''; + printf('Theme %1$s', $ct->title); + } else { + printf('Theme %1$s', $ct->title); + } + } echo '
'; update_right_now_message();