From 598a5a5bc2b5cd77179cf05796876a93aec8cc6f Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 27 Jul 2020 15:19:09 +0000 Subject: [PATCH] Themes: Display a message in theme grid if a theme requires a higher version of PHP or WordPress. This applies to the Themes screen fallback used when JS is turned off. Props afragen, desrosj, SergeyBiryukov. See #48491. git-svn-id: https://develop.svn.wordpress.org/trunk@48640 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/themes.php | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/wp-admin/themes.php b/src/wp-admin/themes.php index 1af3ba6df5..03d917a070 100644 --- a/src/wp-admin/themes.php +++ b/src/wp-admin/themes.php @@ -398,6 +398,57 @@ foreach ( $themes as $theme ) : +

'; + if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) { + _e( 'This theme doesn’t work with your versions of WordPress and PHP.' ); + if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { + printf( + /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ + ' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ), + self_admin_url( 'update-core.php' ), + esc_url( wp_get_update_php_url() ) + ); + wp_update_php_annotation( '

', '' ); + } elseif ( current_user_can( 'update_core' ) ) { + printf( + /* translators: %s: URL to WordPress Updates screen. */ + ' ' . __( 'Please update WordPress.' ), + self_admin_url( 'update-core.php' ) + ); + } elseif ( current_user_can( 'update_php' ) ) { + printf( + /* translators: %s: URL to Update PHP page. */ + ' ' . __( 'Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + wp_update_php_annotation( '

', '' ); + } + } elseif ( ! $theme['compatibleWP'] ) { + _e( 'This theme doesn’t work with your version of WordPress.' ); + if ( current_user_can( 'update_core' ) ) { + printf( + /* translators: %s: URL to WordPress Updates screen. */ + ' ' . __( 'Please update WordPress.' ), + self_admin_url( 'update-core.php' ) + ); + } + } elseif ( ! $theme['compatiblePHP'] ) { + _e( 'This theme doesn’t work with your version of PHP.' ); + if ( current_user_can( 'update_php' ) ) { + printf( + /* translators: %s: URL to Update PHP page. */ + ' ' . __( 'Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + wp_update_php_annotation( '

', '' ); + } + } + echo '

'; + } + ?> +