From 9ac7cc3aa02d7f4268398733c4f3c796b268932d Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 23 Feb 2016 17:19:57 +0000 Subject: [PATCH] Themes: Improve error messages for broken themes. Props mayukojpn for initial patch. Fixes #35286. git-svn-id: https://develop.svn.wordpress.org/trunk@36638 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/network/themes.php | 2 +- src/wp-admin/themes.php | 2 +- src/wp-includes/class-wp-theme.php | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/network/themes.php b/src/wp-admin/network/themes.php index 29dd9e5b57..9466c41017 100644 --- a/src/wp-admin/network/themes.php +++ b/src/wp-admin/network/themes.php @@ -287,7 +287,7 @@ if ( isset( $_GET['enabled'] ) ) { $wp_list_table->views(); if ( 'broken' == $status ) - echo '

' . __('The following themes are installed but incomplete. Themes must have a stylesheet and a template.') . '

'; + echo '

' . __( 'The following themes are installed but incomplete.' ) . '

'; ?>
diff --git a/src/wp-admin/themes.php b/src/wp-admin/themes.php index d229d9261d..d964fc22aa 100644 --- a/src/wp-admin/themes.php +++ b/src/wp-admin/themes.php @@ -295,7 +295,7 @@ if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_

-

+

template && ! ( $this->template = $this->headers['Template'] ) ) { $this->template = $this->stylesheet; if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet . '/index.php' ) ) { - $this->errors = new WP_Error( 'theme_no_index', __( 'Template is missing.' ) ); + $error_message = sprintf( + /* translators: 1: index.php, 2: Codex URL, 3: style.css */ + __( 'Template is missing. Standalone themes need to have a %1$s template file. Child themes need to have a Template header in the %3$s stylesheet.' ), + 'index.php', + __( 'https://codex.wordpress.org/Child_Themes' ), + 'style.css' + ); + $this->errors = new WP_Error( 'theme_no_index', $error_message ); $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) ); return; }