Make WordPress Core


Ignore:
Timestamp:
12/07/2021 08:05:27 PM (5 years ago)
Author:
hellofromTonya
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/themes.php

    r52020 r52341  
    901901                                        ?>
    902902                                        <a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
    903                                         <?php
    904                                         /* translators: %s: Theme name. */
    905                                         $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
    906                                         ?>
    907                                         <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>
     903                                        <# if ( ! data.block_theme ) { #>
     904                                                <?php
     905                                                /* translators: %s: Theme name. */
     906                                                $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
     907                                                ?>
     908                                                <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>
     909                                        <# } #>
    908910                                <# } else { #>
    909911                                        <?php
Note: See TracChangeset for help on using the changeset viewer.