Themes: Hide block themes' live preview link following installation.

Prevent the Customizer/Live Preview button from showing for installed block themes when on the theme installation page.

Props antonvlasenko, costdev, ironprogrammer.
Fixes #54878.



git-svn-id: https://develop.svn.wordpress.org/trunk@52819 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Wilson
2022-03-04 02:37:58 +00:00
parent 77561d0a30
commit 567b2518f8
3 changed files with 34 additions and 5 deletions

View File

@@ -35,9 +35,10 @@ if ( false === $installed_themes ) {
$installed_themes = array();
}
foreach ( $installed_themes as $k => $v ) {
if ( false !== strpos( $k, '/' ) ) {
unset( $installed_themes[ $k ] );
foreach ( $installed_themes as $theme_slug => $theme_data ) {
// Ignore child themes.
if ( str_contains( $theme_slug, '/' ) ) {
unset( $installed_themes[ $theme_slug ] );
}
}
@@ -373,7 +374,9 @@ if ( $tab ) {
<# } #>
<# if ( data.customize_url ) { #>
<# if ( ! data.active ) { #>
<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
<# if ( ! data.block_theme ) { #>
<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
<# } #>
<# } else { #>
<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Customize' ); ?></a>
<# } #>