Make WordPress Core

Changeset 48640


Ignore:
Timestamp:
07/27/2020 03:19:09 PM (3 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/themes.php

    r48638 r48640  
    398398        </div>
    399399    <?php endif; ?>
     400
     401    <?php
     402    if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) {
     403        echo '<div class="notice inline notice-error notice-alt"><p>';
     404        if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) {
     405            _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
     406            if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
     407                printf(
     408                    /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
     409                    ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
     410                    self_admin_url( 'update-core.php' ),
     411                    esc_url( wp_get_update_php_url() )
     412                );
     413                wp_update_php_annotation( '</p><p><em>', '</em>' );
     414            } elseif ( current_user_can( 'update_core' ) ) {
     415                printf(
     416                    /* translators: %s: URL to WordPress Updates screen. */
     417                    ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     418                    self_admin_url( 'update-core.php' )
     419                );
     420            } elseif ( current_user_can( 'update_php' ) ) {
     421                printf(
     422                    /* translators: %s: URL to Update PHP page. */
     423                    ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     424                    esc_url( wp_get_update_php_url() )
     425                );
     426                wp_update_php_annotation( '</p><p><em>', '</em>' );
     427            }
     428        } elseif ( ! $theme['compatibleWP'] ) {
     429            _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
     430            if ( current_user_can( 'update_core' ) ) {
     431                printf(
     432                    /* translators: %s: URL to WordPress Updates screen. */
     433                    ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     434                    self_admin_url( 'update-core.php' )
     435                );
     436            }
     437        } elseif ( ! $theme['compatiblePHP'] ) {
     438            _e( 'This theme doesn&#8217;t work with your version of PHP.' );
     439            if ( current_user_can( 'update_php' ) ) {
     440                printf(
     441                    /* translators: %s: URL to Update PHP page. */
     442                    ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     443                    esc_url( wp_get_update_php_url() )
     444                );
     445                wp_update_php_annotation( '</p><p><em>', '</em>' );
     446            }
     447        }
     448        echo '</p></div>';
     449    }
     450    ?>
    400451
    401452    <span class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></span>
Note: See TracChangeset for help on using the changeset viewer.