diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php
index ea33d9d792..adc11ea021 100644
a
|
b
|
function wp_ajax_query_themes() { |
3571 | 3571 | ) |
3572 | 3572 | ); |
3573 | 3573 | |
3574 | | $theme->num_ratings = number_format_i18n( $theme->num_ratings ); |
3575 | | $theme->preview_url = set_url_scheme( $theme->preview_url ); |
| 3574 | $theme->num_ratings = number_format_i18n( $theme->num_ratings ); |
| 3575 | $theme->preview_url = set_url_scheme( $theme->preview_url ); |
| 3576 | $theme->wp_compatible = is_wp_version_compatible( $theme->requires ); |
| 3577 | $theme->php_compatible = is_php_version_compatible( $theme->requires_php ); |
3576 | 3578 | } |
3577 | 3579 | |
3578 | 3580 | wp_send_json_success( $api ); |
diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php
index 47168057e0..e220e6af26 100644
a
|
b
|
function customize_themes_print_templates() { |
790 | 790 | <?php } ?> |
791 | 791 | <button type="button" class="button button-primary preview-theme" data-slug="{{ data.id }}"><?php _e( 'Live Preview' ); ?></button> |
792 | 792 | <# } else { #> |
793 | | <button type="button" class="button theme-install" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></button> |
794 | | <button type="button" class="button button-primary theme-install preview" data-slug="{{ data.id }}"><?php _e( 'Install & Preview' ); ?></button> |
| 793 | <# if ( data.wp_compatible && data.php_compatible ) { #> |
| 794 | <button type="button" class="button theme-install" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></button> |
| 795 | <button type="button" class="button button-primary theme-install preview" data-slug="{{ data.id }}"><?php _e( 'Install & Preview' ); ?></button> |
| 796 | <# } else { #> |
| 797 | <button type="button" class="button disabled"><?php _e( 'Install' ); ?></button> |
| 798 | <button type="button" class="button button-primary disabled"><?php _e( 'Install & Preview' ); ?></button> |
| 799 | <# } #> |
795 | 800 | <# } #> |
796 | 801 | </div> |
797 | 802 | </div> |
diff --git a/wp-admin/theme-install.php b/wp-admin/theme-install.php
index 944e9d7d0a..1516b792a9 100644
a
|
b
|
if ( $tab ) { |
293 | 293 | <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button> |
294 | 294 | <# } #> |
295 | 295 | <# } else { #> |
296 | | <?php |
297 | | /* translators: %s: Theme name. */ |
298 | | $aria_label = sprintf( __( 'Install %s' ), '{{ data.name }}' ); |
299 | | ?> |
300 | | <a class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a> |
301 | | <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button> |
| 296 | <# if ( data.wp_compatible && data.php_compatible ) { #> |
| 297 | <# /* translators: %s: Theme name. */ #> |
| 298 | <# <?php $aria_label = sprintf( __( 'Install %s' ), '{{ data.name }}' ); ?> #> |
| 299 | <a class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a> |
| 300 | <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button> |
| 301 | <# } else { #> |
| 302 | <# /* translators: %s: Theme name. */ #> |
| 303 | <# <?php $aria_label = sprintf( __( 'Install %s' ), '{{ data.name }}' ); ?> #> |
| 304 | <a class="button button-primary disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a> |
| 305 | <button class="button preview disabled"><?php _e( 'Preview' ); ?></button> |
| 306 | <# } #> |
302 | 307 | <# } #> |
303 | 308 | </div> |
304 | 309 | </div> |
… |
… |
if ( $tab ) { |
315 | 320 | <button class="previous-theme"><span class="screen-reader-text"><?php _e( 'Previous theme' ); ?></span></button> |
316 | 321 | <button class="next-theme"><span class="screen-reader-text"><?php _e( 'Next theme' ); ?></span></button> |
317 | 322 | <# if ( data.installed ) { #> |
318 | | <a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a> |
| 323 | <# if ( data.wp_compatible && data.php_compatible ) { #> |
| 324 | <a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a> |
| 325 | <# } else { #> |
| 326 | <a class="button button-primary activate disabled" ><?php _e( 'Activate' ); ?></a> |
| 327 | <# } #> |
319 | 328 | <# } else { #> |
320 | | <a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a> |
| 329 | <# if ( data.wp_compatible && data.php_compatible ) { #> |
| 330 | <a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a> |
| 331 | <# } else { #> |
| 332 | <a class="button button-primary disabled" ><?php _e( 'Install' ); ?></a> |
| 333 | <# } #> |
321 | 334 | <# } #> |
322 | 335 | </div> |
323 | 336 | <div class="wp-full-overlay-sidebar-content"> |
diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php
index 9d4ec4be36..208aa7b73b 100644
a
|
b
|
final class WP_Customize_Manager { |
5826 | 5826 | $theme->active = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme->slug ); |
5827 | 5827 | |
5828 | 5828 | // Map available theme properties to installed theme properties. |
5829 | | $theme->id = $theme->slug; |
5830 | | $theme->screenshot = array( $theme->screenshot_url ); |
5831 | | $theme->authorAndUri = wp_kses( $theme->author['display_name'], $themes_allowedtags ); |
| 5829 | $theme->id = $theme->slug; |
| 5830 | $theme->screenshot = array( $theme->screenshot_url ); |
| 5831 | $theme->authorAndUri = wp_kses( $theme->author['display_name'], $themes_allowedtags ); |
| 5832 | $theme->wp_compatible = is_wp_version_compatible( $theme->requires ); |
| 5833 | $theme->php_compatible = is_php_version_compatible( $theme->requires_php ); |
5832 | 5834 | |
5833 | 5835 | if ( isset( $theme->parent ) ) { |
5834 | 5836 | $theme->parent = $theme->parent['slug']; |
diff --git a/wp-includes/customize/class-wp-customize-theme-control.php b/wp-includes/customize/class-wp-customize-theme-control.php
index 10f09d180b..fc2abe8dbe 100644
a
|
b
|
class WP_Customize_Theme_Control extends WP_Customize_Control { |
129 | 129 | <div class="theme-id-container"> |
130 | 130 | <h3 class="theme-name" id="{{ data.section }}-{{ data.theme.id }}-name">{{ data.theme.name }}</h3> |
131 | 131 | <div class="theme-actions"> |
132 | | <button type="button" class="button button-primary theme-install preview" aria-label="<?php echo esc_attr( $install_label ); ?>" data-slug="{{ data.theme.id }}" data-name="{{ data.theme.name }}"><?php _e( 'Install & Preview' ); ?></button> |
| 132 | <# if ( data.theme.wp_compatible && data.theme.php_compatible ) { #> |
| 133 | <button type="button" class="button button-primary theme-install preview" aria-label="<?php echo esc_attr( $install_label ); ?>" data-slug="{{ data.theme.id }}" data-name="{{ data.theme.name }}"><?php _e( 'Install & Preview' ); ?></button> |
| 134 | <# } else { #> |
| 135 | <button type="button" class="button button-primary disabled" aria-label="<?php echo esc_attr( $install_label ); ?>" disabled><?php _e( 'Install & Preview' ); ?></button> |
| 136 | <# } #> |
133 | 137 | </div> |
134 | 138 | </div> |
135 | 139 | <# } #> |