Make WordPress Core


Ignore:
Timestamp:
07/27/2020 03:02:19 PM (6 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, Add Themes screen, and the Customizer theme browser.

Props afragen, desrosj, SergeyBiryukov.
See #48491.

File:
1 edited

Legend:

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

    r48636 r48638  
    614614                        <div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available.' ); ?></p></div>
    615615                <# } #>
     616        <# } #>
     617
     618        <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #>
     619                <div class="notice notice-error notice-alt"><p>
     620                        <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #>
     621                                <?php
     622                                _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
     623                                if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
     624                                        printf(
     625                                                /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
     626                                                ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
     627                                                self_admin_url( 'update-core.php' ),
     628                                                esc_url( wp_get_update_php_url() )
     629                                        );
     630                                        wp_update_php_annotation( '</p><p><em>', '</em>' );
     631                                } elseif ( current_user_can( 'update_core' ) ) {
     632                                        printf(
     633                                                /* translators: %s: URL to WordPress Updates screen. */
     634                                                ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     635                                                self_admin_url( 'update-core.php' )
     636                                        );
     637                                } elseif ( current_user_can( 'update_php' ) ) {
     638                                        printf(
     639                                                /* translators: %s: URL to Update PHP page. */
     640                                                ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     641                                                esc_url( wp_get_update_php_url() )
     642                                        );
     643                                        wp_update_php_annotation( '</p><p><em>', '</em>' );
     644                                }
     645                                ?>
     646                        <# } else if ( ! data.compatibleWP ) { #>
     647                                <?php
     648                                _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
     649                                if ( current_user_can( 'update_core' ) ) {
     650                                        printf(
     651                                                /* translators: %s: URL to WordPress Updates screen. */
     652                                                ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     653                                                self_admin_url( 'update-core.php' )
     654                                        );
     655                                }
     656                                ?>
     657                        <# } else if ( ! data.compatiblePHP ) { #>
     658                                <?php
     659                                _e( 'This theme doesn&#8217;t work with your version of PHP.' );
     660                                if ( current_user_can( 'update_php' ) ) {
     661                                        printf(
     662                                                /* translators: %s: URL to Update PHP page. */
     663                                                ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     664                                                esc_url( wp_get_update_php_url() )
     665                                        );
     666                                        wp_update_php_annotation( '</p><p><em>', '</em>' );
     667                                }
     668                                ?>
     669                        <# } #>
     670                </p></div>
    616671        <# } #>
    617672
Note: See TracChangeset for help on using the changeset viewer.