Avoid notice when themes dir is empty or missing. Don't reset current theme in current_theme_info() if there are no themes. Show warning in Right Now if there are no themes. Props azaozz. fixes #19089
git-svn-id: http://svn.automattic.com/wordpress/trunk@19251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
58cdff8ce9
commit
6bbc8d4ce4
|
@ -387,7 +387,11 @@ function wp_dashboard_right_now() {
|
|||
$ct = current_theme_info();
|
||||
|
||||
echo "\n\t<p>";
|
||||
if ( !empty($wp_registered_sidebars) ) {
|
||||
|
||||
if ( empty( $ct->stylesheet_dir ) ) {
|
||||
if ( ! is_multisite() || is_super_admin() )
|
||||
echo '<span class="error-message">' . __('ERROR: The themes directory is either empty or doesn’t exist. Please check your installation.') . '</span>';
|
||||
} elseif ( ! empty($wp_registered_sidebars) ) {
|
||||
$sidebars_widgets = wp_get_sidebars_widgets();
|
||||
$num_widgets = 0;
|
||||
foreach ( (array) $sidebars_widgets as $k => $v ) {
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in New Issue