diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index f3691b1f0b..223d639ee3 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -366,7 +366,7 @@ function wp_dashboard_right_now() { if ( $theme->errors() ) { if ( ! is_multisite() || is_super_admin() ) - echo '' . __('ERROR: The themes directory is either empty or doesn’t exist. Please check your installation.') . ''; + echo '' . sprintf( __( 'ERROR: %s' ), $theme->errors()->get_error_message() ) . ''; } elseif ( ! empty($wp_registered_sidebars) ) { $sidebars_widgets = wp_get_sidebars_widgets(); $num_widgets = 0; diff --git a/wp-admin/themes.php b/wp-admin/themes.php index a9b07b60a4..15cb4928b6 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -139,6 +139,15 @@ $customize_title = sprintf( __( 'Customize “%s”' ), $ct->display('Na display('Name'); ?> +errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) { + echo '

' . sprintf( __( 'ERROR: %s' ), $ct->errors()->get_error_message() ) . '

'; +} + +// Certain error codes are less fatal than others. We can still display theme information in most cases. +if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() ) + && in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?> +

@@ -292,11 +303,9 @@ if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_ + " . $broken_theme->get('Name') ." " . $broken_theme->errors()->get_error_message() . " "; diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index 0d47f025c1..cd4ef4ee08 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -206,7 +206,7 @@ final class WP_Theme implements ArrayAccess { } elseif ( ! file_exists( $this->theme_root . '/' . $theme_file ) ) { $this->headers['Name'] = $this->stylesheet; if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet ) ) - $this->errors = new WP_Error( 'theme_not_found', __( 'The theme directory does not exist.' ) ); + $this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), $this->stylesheet ) ); else $this->errors = new WP_Error( 'theme_no_stylesheet', __( 'Stylesheet is missing.' ) ); $this->template = $this->stylesheet;