Make WordPress Core


Ignore:
Timestamp:
11/10/2025 09:04:46 PM (7 months ago)
Author:
westonruter
Message:

Themes: Restore 'Live Preview' button for block themes.

Note that the return query parameter is not yet functional in the Site Editor. See Gutenberg#47934.

Follow-up to [52341], [52346], [52353], [52802].

Props ninomiho, mcsf, dhruval04, praful2111, mlaetitia1986.
See #54578.
Fixes #64159.

File:
1 edited

Legend:

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

    r59960 r61195  
    646646
    647647            <?php
    648             if ( ! $theme['blockTheme'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
     648            if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
    649649                /* translators: %s: Theme name. */
    650650                $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
     
    10351035                    ><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
    10361036
    1037                     <# if ( ! data.blockTheme ) { #>
    1038                         <?php
    1039                         /* translators: %s: Theme name. */
    1040                         $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
    1041                         ?>
    1042                         <a class="button button-primary hide-if-no-customize disabled"
    1043                             aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
    1044                         ><?php _e( 'Live Preview' ); ?></a>
    1045                     <# } #>
     1037                    <?php
     1038                    /* translators: %s: Theme name. */
     1039                    $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
     1040                    ?>
     1041                    <a class="button button-primary hide-if-no-customize disabled"
     1042                        aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
     1043                    ><?php _e( 'Live Preview' ); ?></a>
    10461044                <# } #>
    10471045            <# } #>
     
    12621260            <div class="inactive-theme">
    12631261                <# if ( data.compatibleWP && data.compatiblePHP ) { #>
    1264                     <# if ( ! data.blockTheme ) { #>
    1265                         <?php
    1266                         /* translators: %s: Theme name. */
    1267                         $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
    1268                         ?>
    1269                         <a class="button button-primary load-customize hide-if-no-customize"
    1270                             href="{{{ data.actions.customize }}}"
    1271                             aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
    1272                         ><?php _e( 'Live Preview' ); ?></a>
    1273                     <# } #>
     1262                    <?php
     1263                    /* translators: %s: Theme name. */
     1264                    $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
     1265                    ?>
     1266                    <a class="button button-primary load-customize hide-if-no-customize"
     1267                        href="{{{ data.actions.customize }}}"
     1268                        aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
     1269                    ><?php _e( 'Live Preview' ); ?></a>
    12741270
    12751271                    <# if ( data.actions.activate ) { #>
     
    12841280                    <# } #>
    12851281                <# } else { #>
    1286                     <# if ( ! data.blockTheme ) { #>
    1287                         <?php
    1288                         /* translators: %s: Theme name. */
    1289                         $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
    1290                         ?>
    1291                         <a class="button button-primary hide-if-no-customize disabled"
    1292                             aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
    1293                         ><?php _e( 'Live Preview' ); ?></a>
    1294                     <# } #>
     1282                    <?php
     1283                    /* translators: %s: Theme name. */
     1284                    $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
     1285                    ?>
     1286                    <a class="button button-primary hide-if-no-customize disabled"
     1287                        aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
     1288                    ><?php _e( 'Live Preview' ); ?></a>
    12951289
    12961290                    <# if ( data.actions.activate ) { #>
Note: See TracChangeset for help on using the changeset viewer.