diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 889d342998..66eb555c0e 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -387,7 +387,11 @@ function wp_dashboard_right_now() { $ct = current_theme_info(); echo "\n\t

"; - if ( !empty($wp_registered_sidebars) ) { + + if ( empty( $ct->stylesheet_dir ) ) { + if ( ! is_multisite() || is_super_admin() ) + echo '' . __('ERROR: The themes directory is either empty or doesn’t exist. Please check your installation.') . ''; + } elseif ( ! empty($wp_registered_sidebars) ) { $sidebars_widgets = wp_get_sidebars_widgets(); $num_widgets = 0; foreach ( (array) $sidebars_widgets as $k => $v ) { diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index f645d4408f..7cb5dc4a35 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -16,10 +16,18 @@ function current_theme_info() { $themes = get_themes(); $current_theme = get_current_theme(); + + if ( ! $themes ) { + $ct = new stdClass; + $ct->name = $current_theme; + return $ct; + } + if ( ! isset( $themes[$current_theme] ) ) { delete_option( 'current_theme' ); $current_theme = get_current_theme(); } + $ct = new stdClass; $ct->name = $current_theme; $ct->title = $themes[$current_theme]['Title']; diff --git a/wp-includes/theme.php b/wp-includes/theme.php index bca713427d..c76414ac23 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -518,12 +518,13 @@ function get_current_theme() { return $theme; $themes = get_themes(); - $theme_names = array_keys($themes); - $current_template = get_option('template'); - $current_stylesheet = get_option('stylesheet'); - $current_theme = 'Twenty Ten'; + $current_theme = 'Twenty Eleven'; if ( $themes ) { + $theme_names = array_keys( $themes ); + $current_template = get_option( 'template' ); + $current_stylesheet = get_option( 'stylesheet' ); + foreach ( (array) $theme_names as $theme_name ) { if ( $themes[$theme_name]['Stylesheet'] == $current_stylesheet && $themes[$theme_name]['Template'] == $current_template ) {