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-admin/theme-install.php

    r48637 r48638  
    272272        <div class="theme-screenshot blank"></div>
    273273    <# } #>
     274
     275    <# if ( data.installed ) { #>
     276        <div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div>
     277    <# } #>
     278
     279    <# if ( ! data.compatible_wp || ! data.compatible_php ) { #>
     280        <div class="notice notice-error notice-alt"><p>
     281            <# if ( ! data.compatible_wp && ! data.compatible_php ) { #>
     282                <?php
     283                _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
     284                if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
     285                    printf(
     286                        /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
     287                        ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
     288                        self_admin_url( 'update-core.php' ),
     289                        esc_url( wp_get_update_php_url() )
     290                    );
     291                    wp_update_php_annotation( '</p><p><em>', '</em>' );
     292                } elseif ( current_user_can( 'update_core' ) ) {
     293                    printf(
     294                        /* translators: %s: URL to WordPress Updates screen. */
     295                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     296                        self_admin_url( 'update-core.php' )
     297                    );
     298                } elseif ( current_user_can( 'update_php' ) ) {
     299                    printf(
     300                        /* translators: %s: URL to Update PHP page. */
     301                        ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     302                        esc_url( wp_get_update_php_url() )
     303                    );
     304                    wp_update_php_annotation( '</p><p><em>', '</em>' );
     305                }
     306                ?>
     307            <# } else if ( ! data.compatible_wp ) { #>
     308                <?php
     309                _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
     310                if ( current_user_can( 'update_core' ) ) {
     311                    printf(
     312                        /* translators: %s: URL to WordPress Updates screen. */
     313                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     314                        self_admin_url( 'update-core.php' )
     315                    );
     316                }
     317                ?>
     318            <# } else if ( ! data.compatible_php ) { #>
     319                <?php
     320                _e( 'This theme doesn&#8217;t work with your version of PHP.' );
     321                if ( current_user_can( 'update_php' ) ) {
     322                    printf(
     323                        /* translators: %s: URL to Update PHP page. */
     324                        ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     325                        esc_url( wp_get_update_php_url() )
     326                    );
     327                    wp_update_php_annotation( '</p><p><em>', '</em>' );
     328                }
     329                ?>
     330            <# } #>
     331        </p></div>
     332    <# } #>
     333
    274334    <span class="more-details"><?php _ex( 'Details &amp; Preview', 'theme' ); ?></span>
    275335    <div class="theme-author">
     
    339399        </div>
    340400    </div>
    341 
    342     <# if ( data.installed ) { #>
    343         <div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div>
    344     <# } #>
    345401</script>
    346402
Note: See TracChangeset for help on using the changeset viewer.