diff --git a/src/js/_enqueues/wp/theme.js b/src/js/_enqueues/wp/theme.js index 9b3db9a2c8..2115037671 100644 --- a/src/js/_enqueues/wp/theme.js +++ b/src/js/_enqueues/wp/theme.js @@ -28,11 +28,16 @@ themes.Model = Backbone.Model.extend({ initialize: function() { var description; - // If theme is already installed, set an attribute. + // If the theme is already installed, set an attribute. if ( _.indexOf( themes.data.installedThemes, this.get( 'slug' ) ) !== -1 ) { this.set({ installed: true }); } + // If the theme is active, set an attribute. + if ( themes.data.activeTheme === this.get( 'slug' ) ) { + this.set({ active: true }); + } + // Set the attributes. this.set({ // `slug` is for installation, `id` is for existing. diff --git a/src/wp-admin/theme-install.php b/src/wp-admin/theme-install.php index 33525661ae..9afa79369f 100644 --- a/src/wp-admin/theme-install.php +++ b/src/wp-admin/theme-install.php @@ -72,6 +72,7 @@ wp_localize_script( 'selectFeatureFilter' => __( 'Select one or more Theme features to filter by' ), ), 'installedThemes' => array_keys( $installed_themes ), + 'activeTheme' => get_stylesheet(), ) ); @@ -289,10 +290,18 @@ if ( $tab ) { $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); ?> <# if ( data.activate_url ) { #> - + <# if ( ! data.active ) { #> + + <# } else { #> + + <# } #> <# } #> <# if ( data.customize_url ) { #> - + <# if ( ! data.active ) { #> + + <# } else { #> + + <# } #> <# } else { #> <# } #> @@ -343,7 +352,15 @@ if ( $tab ) { <# if ( data.installed ) { #> <# if ( data.compatible_wp && data.compatible_php ) { #> - + + <# if ( ! data.active ) { #> + + <# } else { #> + + <# } #> <# } else { #> <# } #>