Make WordPress Core


Ignore:
Timestamp:
07/27/2020 03:02:19 PM (5 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-includes/customize/class-wp-customize-theme-control.php

    r47819 r48638  
    106106                    </p>
    107107                </div>
     108            <# } #>
     109
     110            <# if ( ! data.theme.compatibleWP || ! data.theme.compatiblePHP ) { #>
     111                <div class="notice notice-error notice-alt"><p>
     112                    <# if ( ! data.theme.compatibleWP && ! data.theme.compatiblePHP ) { #>
     113                        <?php
     114                        _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
     115                        if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
     116                            printf(
     117                                /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
     118                                ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
     119                                self_admin_url( 'update-core.php' ),
     120                                esc_url( wp_get_update_php_url() )
     121                            );
     122                            wp_update_php_annotation( '</p><p><em>', '</em>' );
     123                        } elseif ( current_user_can( 'update_core' ) ) {
     124                            printf(
     125                                /* translators: %s: URL to WordPress Updates screen. */
     126                                ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     127                                self_admin_url( 'update-core.php' )
     128                            );
     129                        } elseif ( current_user_can( 'update_php' ) ) {
     130                            printf(
     131                                /* translators: %s: URL to Update PHP page. */
     132                                ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     133                                esc_url( wp_get_update_php_url() )
     134                            );
     135                            wp_update_php_annotation( '</p><p><em>', '</em>' );
     136                        }
     137                        ?>
     138                    <# } else if ( ! data.theme.compatibleWP ) { #>
     139                        <?php
     140                        _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
     141                        if ( current_user_can( 'update_core' ) ) {
     142                            printf(
     143                                /* translators: %s: URL to WordPress Updates screen. */
     144                                ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     145                                self_admin_url( 'update-core.php' )
     146                            );
     147                        }
     148                        ?>
     149                    <# } else if ( ! data.theme.compatiblePHP ) { #>
     150                        <?php
     151                        _e( 'This theme doesn&#8217;t work with your version of PHP.' );
     152                        if ( current_user_can( 'update_php' ) ) {
     153                            printf(
     154                                /* translators: %s: URL to Update PHP page. */
     155                                ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     156                                esc_url( wp_get_update_php_url() )
     157                            );
     158                            wp_update_php_annotation( '</p><p><em>', '</em>' );
     159                        }
     160                        ?>
     161                    <# } #>
     162                </p></div>
    108163            <# } #>
    109164
Note: See TracChangeset for help on using the changeset viewer.