Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions src/wp-admin/includes/class-theme-installer-skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,24 @@ public function after() {

$install_actions = array();

if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) && ! $theme_info->is_block_theme() ) {
$customize_url = add_query_arg(
array(
'theme' => urlencode( $stylesheet ),
'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ),
),
admin_url( 'customize.php' )
);
if ( current_user_can( 'edit_theme_options' ) && ( $theme_info->is_block_theme() || current_user_can( 'customize' ) ) ) {
if ( $theme_info->is_block_theme() ) {
$customize_url = add_query_arg(
array(
'wp_theme_preview' => urlencode( $stylesheet ),
'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ),
),
admin_url( 'site-editor.php' )
);
} else {
$customize_url = add_query_arg(
array(
'theme' => urlencode( $stylesheet ),
'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ),
),
admin_url( 'customize.php' )
);
}

$install_actions['preview'] = sprintf(
'<a href="%s" class="hide-if-no-customize load-customize">' .
Expand Down
52 changes: 23 additions & 29 deletions src/wp-admin/themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@
><?php _ex( 'Cannot Activate', 'theme' ); ?></a>

<?php
if ( ! $theme['blockTheme'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
/* translators: %s: Theme name. */
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
?>
Expand Down Expand Up @@ -1034,15 +1034,13 @@ function wp_theme_auto_update_setting_template() {
aria-label="<?php echo esc_attr( $aria_label ); ?>"
><?php _ex( 'Cannot Activate', 'theme' ); ?></a>

<# if ( ! data.blockTheme ) { #>
<?php
/* translators: %s: Theme name. */
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
?>
<a class="button button-primary hide-if-no-customize disabled"
aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
><?php _e( 'Live Preview' ); ?></a>
<# } #>
<?php
/* translators: %s: Theme name. */
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
?>
<a class="button button-primary hide-if-no-customize disabled"
aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
><?php _e( 'Live Preview' ); ?></a>
<# } #>
<# } #>
</div>
Expand Down Expand Up @@ -1261,16 +1259,14 @@ function wp_theme_auto_update_setting_template() {

<div class="inactive-theme">
<# if ( data.compatibleWP && data.compatiblePHP ) { #>
<# if ( ! data.blockTheme ) { #>
<?php
/* translators: %s: Theme name. */
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
?>
<a class="button button-primary load-customize hide-if-no-customize"
href="{{{ data.actions.customize }}}"
aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
><?php _e( 'Live Preview' ); ?></a>
<# } #>
<?php
/* translators: %s: Theme name. */
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
?>
<a class="button button-primary load-customize hide-if-no-customize"
href="{{{ data.actions.customize }}}"
aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
><?php _e( 'Live Preview' ); ?></a>

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

<# if ( data.actions.activate ) { #>
<?php
Expand Down
Loading