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
This commit is contained in:
Sergey Biryukov 2020-07-27 15:19:09 +00:00
parent 6475d32964
commit 598a5a5bc2
1 changed files with 51 additions and 0 deletions

View File

@ -398,6 +398,57 @@ foreach ( $themes as $theme ) :
</div>
<?php endif; ?>
<?php
if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) {
echo '<div class="notice inline notice-error notice-alt"><p>';
if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) {
_e( 'This theme doesn&#8217;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. */
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
self_admin_url( 'update-core.php' ),
esc_url( wp_get_update_php_url() )
);
wp_update_php_annotation( '</p><p><em>', '</em>' );
} elseif ( current_user_can( 'update_core' ) ) {
printf(
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
self_admin_url( 'update-core.php' )
);
} elseif ( current_user_can( 'update_php' ) ) {
printf(
/* translators: %s: URL to Update PHP page. */
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
);
wp_update_php_annotation( '</p><p><em>', '</em>' );
}
} elseif ( ! $theme['compatibleWP'] ) {
_e( 'This theme doesn&#8217;t work with your version of WordPress.' );
if ( current_user_can( 'update_core' ) ) {
printf(
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
self_admin_url( 'update-core.php' )
);
}
} elseif ( ! $theme['compatiblePHP'] ) {
_e( 'This theme doesn&#8217;t work with your version of PHP.' );
if ( current_user_can( 'update_php' ) ) {
printf(
/* translators: %s: URL to Update PHP page. */
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
);
wp_update_php_annotation( '</p><p><em>', '</em>' );
}
}
echo '</p></div>';
}
?>
<span class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></span>
<div class="theme-author">
<?php