Themes: Hide "Live Preview" button for FSE block themes.

Currently, the Site Editor does not have a live preview feature for non-activated block themes.

This commit is a stop-gate to remove the "Live Preview" button for those themes. It avoids confusing users and avoiding a notification message that doesn't make sense.

Props antonvlasenko, costdev, hellofromTonya, kafleg, paaljoachim.
Fixes #54578.
Built from https://develop.svn.wordpress.org/trunk@52341


git-svn-id: http://core.svn.wordpress.org/trunk@51933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
hellofromTonya 2021-12-07 20:07:00 +00:00
parent 40b22d1209
commit 9aba2584bb
3 changed files with 9 additions and 6 deletions

View File

@ -782,6 +782,7 @@ function wp_prepare_themes_for_js( $themes = null ) {
? wp_nonce_url( admin_url( 'themes.php?action=' . $auto_update_action . '&stylesheet=' . $encoded_slug ), 'updates' )
: null,
),
'block_theme' => $theme->is_block_theme(),
);
}

View File

@ -900,11 +900,13 @@ function wp_theme_auto_update_setting_template() {
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
?>
<a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
<?php
/* translators: %s: Theme name. */
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
?>
<a aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
<# if ( ! data.block_theme ) { #>
<?php
/* translators: %s: Theme name. */
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
?>
<a aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
<# } #>
<# } else { #>
<?php
/* translators: %s: Theme name. */

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-beta1-52340';
$wp_version = '5.9-beta1-52341';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.