wp/wp-admin/themes.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
--- a/wp/wp-admin/themes.php	Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/themes.php	Fri Sep 05 18:40:08 2025 +0200
@@ -153,7 +153,7 @@
 	} else {
 		$help_install = '<p>' . sprintf(
 			/* translators: %s: https://wordpress.org/themes/ */
-			__( 'If you would like to see more themes to choose from, click on the &#8220;Add New&#8221; button and you will be able to browse or search for additional themes from the <a href="%s">WordPress Theme Directory</a>. Themes in the WordPress Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they&#8217;re free!' ),
+			__( 'If you would like to see more themes to choose from, click on the &#8220;Add New Theme&#8221; button and you will be able to browse or search for additional themes from the <a href="%s">WordPress Theme Directory</a>. Themes in the WordPress Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they&#8217;re free!' ),
 			__( 'https://wordpress.org/themes/' )
 		) . '</p>';
 	}
@@ -199,15 +199,15 @@
 		)
 	);
 
-	$help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/support/article/plugins-themes-auto-updates/">Learn more: Auto-updates documentation</a>' ) . '</p>';
+	$help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/documentation/article/plugins-themes-auto-updates/">Documentation on Auto-updates</a>' ) . '</p>';
 } // End if 'update_themes' && 'wp_is_auto_update_enabled_for_type'.
 
 get_current_screen()->set_help_sidebar(
 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
-	'<p>' . __( '<a href="https://wordpress.org/support/article/using-themes/">Documentation on Using Themes</a>' ) . '</p>' .
-	'<p>' . __( '<a href="https://wordpress.org/support/article/appearance-themes-screen/">Documentation on Managing Themes</a>' ) . '</p>' .
+	'<p>' . __( '<a href="https://wordpress.org/documentation/article/work-with-themes/">Documentation on Using Themes</a>' ) . '</p>' .
+	'<p>' . __( '<a href="https://wordpress.org/documentation/article/appearance-themes-screen/">Documentation on Managing Themes</a>' ) . '</p>' .
 	$help_sidebar_autoupdates .
-	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
+	'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
 );
 
 if ( current_user_can( 'switch_themes' ) ) {
@@ -215,7 +215,9 @@
 } else {
 	$themes = wp_prepare_themes_for_js( array( wp_get_theme() ) );
 }
-wp_reset_vars( array( 'theme', 'search' ) );
+
+$theme  = ! empty( $_REQUEST['theme'] ) ? sanitize_text_field( $_REQUEST['theme'] ) : '';
+$search = ! empty( $_REQUEST['search'] ) ? sanitize_text_field( $_REQUEST['search'] ) : '';
 
 wp_localize_script(
 	'theme',
@@ -229,12 +231,11 @@
 			'adminUrl'      => parse_url( admin_url(), PHP_URL_PATH ),
 		),
 		'l10n'     => array(
-			'addNew'            => __( 'Add New Theme' ),
-			'search'            => __( 'Search Installed Themes' ),
-			'searchPlaceholder' => __( 'Search installed themes...' ), // Placeholder (no ellipsis).
+			'addNew'        => __( 'Add New Theme' ),
+			'search'        => __( 'Search installed themes' ),
 			/* translators: %d: Number of themes. */
-			'themesFound'       => __( 'Number of Themes found: %d' ),
-			'noThemesFound'     => __( 'No themes found. Try a different search.' ),
+			'themesFound'   => __( 'Number of Themes found: %d' ),
+			'noThemesFound' => __( 'No themes found. Try a different search.' ),
 		),
 	)
 );
@@ -250,59 +251,105 @@
 	<h1 class="wp-heading-inline"><?php esc_html_e( 'Themes' ); ?>
 		<span class="title-count theme-count"><?php echo ! empty( $_GET['search'] ) ? __( '&hellip;' ) : count( $themes ); ?></span>
 	</h1>
-
 	<?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
-		<a href="<?php echo esc_url( admin_url( 'theme-install.php' ) ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x( 'Add New', 'theme' ); ?></a>
+		<a href="<?php echo esc_url( admin_url( 'theme-install.php' ) ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html__( 'Add New Theme' ); ?></a>
 	<?php endif; ?>
+	<hr class="wp-header-end">
+	<form class="search-form search-themes"><p class="search-box"></p></form>
 
-	<form class="search-form"></form>
-
-	<hr class="wp-header-end">
 <?php
 if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) {
-	?>
-	<div id="message1" class="updated notice is-dismissible"><p><?php _e( 'The active theme is broken. Reverting to the default theme.' ); ?></p></div>
-	<?php
+	wp_admin_notice(
+		__( 'The active theme is broken. Reverting to the default theme.' ),
+		array(
+			'id'                 => 'message1',
+			'additional_classes' => array( 'updated' ),
+			'dismissible'        => true,
+		)
+	);
 } elseif ( isset( $_GET['activated'] ) ) {
 	if ( isset( $_GET['previewed'] ) ) {
-		?>
-		<div id="message2" class="updated notice is-dismissible"><p><?php _e( 'Settings saved and theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div>
-		<?php
+		wp_admin_notice(
+			__( 'Settings saved and theme activated.' ) . ' <a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Visit site' ) . '</a>',
+			array(
+				'id'                 => 'message2',
+				'additional_classes' => array( 'updated' ),
+				'dismissible'        => true,
+			)
+		);
 	} else {
-		?>
-		<div id="message2" class="updated notice is-dismissible"><p><?php _e( 'New theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div>
-		<?php
+		wp_admin_notice(
+			__( 'New theme activated.' ) . ' <a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Visit site' ) . '</a>',
+			array(
+				'id'                 => 'message2',
+				'additional_classes' => array( 'updated' ),
+				'dismissible'        => true,
+			)
+		);
 	}
 } elseif ( isset( $_GET['deleted'] ) ) {
-	?>
-	<div id="message3" class="updated notice is-dismissible"><p><?php _e( 'Theme deleted.' ); ?></p></div>
-	<?php
+	wp_admin_notice(
+		__( 'Theme deleted.' ),
+		array(
+			'id'                 => 'message3',
+			'additional_classes' => array( 'updated' ),
+			'dismissible'        => true,
+		)
+	);
 } elseif ( isset( $_GET['delete-active-child'] ) ) {
-	?>
-	<div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div>
-	<?php
+	wp_admin_notice(
+		__( 'You cannot delete a theme while it has an active child theme.' ),
+		array(
+			'id'                 => 'message4',
+			'additional_classes' => array( 'error' ),
+		)
+	);
 } elseif ( isset( $_GET['resumed'] ) ) {
-	?>
-	<div id="message5" class="updated notice is-dismissible"><p><?php _e( 'Theme resumed.' ); ?></p></div>
-	<?php
+	wp_admin_notice(
+		__( 'Theme resumed.' ),
+		array(
+			'id'                 => 'message5',
+			'additional_classes' => array( 'updated' ),
+			'dismissible'        => true,
+		)
+	);
 } elseif ( isset( $_GET['error'] ) && 'resuming' === $_GET['error'] ) {
-	?>
-	<div id="message6" class="error"><p><?php _e( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ); ?></p></div>
-	<?php
+	wp_admin_notice(
+		__( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ),
+		array(
+			'id'                 => 'message6',
+			'additional_classes' => array( 'error' ),
+		)
+	);
 } elseif ( isset( $_GET['enabled-auto-update'] ) ) {
-	?>
-	<div id="message7" class="updated notice is-dismissible"><p><?php _e( 'Theme will be auto-updated.' ); ?></p></div>
-	<?php
+	wp_admin_notice(
+		__( 'Theme will be auto-updated.' ),
+		array(
+			'id'                 => 'message7',
+			'additional_classes' => array( 'updated' ),
+			'dismissible'        => true,
+		)
+	);
 } elseif ( isset( $_GET['disabled-auto-update'] ) ) {
-	?>
-	<div id="message8" class="updated notice is-dismissible"><p><?php _e( 'Theme will no longer be auto-updated.' ); ?></p></div>
-	<?php
+	wp_admin_notice(
+		__( 'Theme will no longer be auto-updated.' ),
+		array(
+			'id'                 => 'message8',
+			'additional_classes' => array( 'updated' ),
+			'dismissible'        => true,
+		)
+	);
 }
 
 $current_theme = wp_get_theme();
 
 if ( $current_theme->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
-	echo '<div class="error"><p>' . __( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message() . '</p></div>';
+	wp_admin_notice(
+		__( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message(),
+		array(
+			'additional_classes' => array( 'error' ),
+		)
+	);
 }
 
 $current_theme_actions = array();
@@ -395,130 +442,144 @@
 	<?php } ?>
 
 	<?php if ( $theme['hasUpdate'] ) : ?>
-		<?php if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) : ?>
-			<div class="update-message notice inline notice-warning notice-alt"><p>
-				<?php if ( $theme['hasPackage'] ) : ?>
-					<?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?>
-				<?php else : ?>
-					<?php _e( 'New version available.' ); ?>
-				<?php endif; ?>
-			</p></div>
-		<?php else : ?>
-			<div class="update-message notice inline notice-error notice-alt"><p>
-				<?php
-				if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
-					printf(
-						/* translators: %s: Theme name. */
-						__( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
-						$theme['name']
+		<?php
+		if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) :
+			if ( $theme['hasPackage'] ) {
+				$new_version_available = __( 'New version available. <button class="button-link" type="button">Update now</button>' );
+			} else {
+				$new_version_available = __( 'New version available.' );
+			}
+			wp_admin_notice(
+				$new_version_available,
+				array(
+					'type'               => 'warning',
+					'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ),
+				)
+			);
+		else :
+			$theme_update_error = '';
+			if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
+				$theme_update_error .= sprintf(
+					/* translators: %s: Theme name. */
+					__( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
+					$theme['name']
+				);
+				if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
+					$theme_update_error .= sprintf(
+						/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
+						' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
+						self_admin_url( 'update-core.php' ),
+						esc_url( wp_get_update_php_url() )
+					);
+					wp_update_php_annotation( '</p><p><em>', '</em>', false );
+				} elseif ( current_user_can( 'update_core' ) ) {
+					$theme_update_error .= sprintf(
+						/* translators: %s: URL to WordPress Updates screen. */
+						' ' . __( '<a href="%s">Please update WordPress</a>.' ),
+						self_admin_url( 'update-core.php' )
+					);
+				} elseif ( current_user_can( 'update_php' ) ) {
+					$theme_update_error .= sprintf(
+						/* translators: %s: URL to Update PHP page. */
+						' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
+						esc_url( wp_get_update_php_url() )
 					);
-					if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
-						printf(
-							/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
-							' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
-							self_admin_url( 'update-core.php' ),
-							esc_url( wp_get_update_php_url() )
-						);
-						wp_update_php_annotation( '</p><p><em>', '</em>' );
-					} elseif ( current_user_can( 'update_core' ) ) {
-						printf(
-							/* translators: %s: URL to WordPress Updates screen. */
-							' ' . __( '<a href="%s">Please update WordPress</a>.' ),
-							self_admin_url( 'update-core.php' )
-						);
-					} elseif ( current_user_can( 'update_php' ) ) {
-						printf(
-							/* translators: %s: URL to Update PHP page. */
-							' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
-							esc_url( wp_get_update_php_url() )
-						);
-						wp_update_php_annotation( '</p><p><em>', '</em>' );
-					}
-				} elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
-					printf(
-						/* translators: %s: Theme name. */
-						__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
-						$theme['name']
+					wp_update_php_annotation( '</p><p><em>', '</em>', false );
+				}
+			} elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
+				$theme_update_error .= sprintf(
+					/* translators: %s: Theme name. */
+					__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
+					$theme['name']
+				);
+				if ( current_user_can( 'update_core' ) ) {
+					$theme_update_error .= sprintf(
+						/* translators: %s: URL to WordPress Updates screen. */
+						' ' . __( '<a href="%s">Please update WordPress</a>.' ),
+						self_admin_url( 'update-core.php' )
 					);
-					if ( current_user_can( 'update_core' ) ) {
-						printf(
-							/* translators: %s: URL to WordPress Updates screen. */
-							' ' . __( '<a href="%s">Please update WordPress</a>.' ),
-							self_admin_url( 'update-core.php' )
-						);
-					}
-				} elseif ( ! $theme['updateResponse']['compatiblePHP'] ) {
-					printf(
-						/* translators: %s: Theme name. */
-						__( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
-						$theme['name']
+				}
+			} elseif ( ! $theme['updateResponse']['compatiblePHP'] ) {
+				$theme_update_error .= sprintf(
+					/* translators: %s: Theme name. */
+					__( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
+					$theme['name']
+				);
+				if ( current_user_can( 'update_php' ) ) {
+					$theme_update_error .= sprintf(
+						/* translators: %s: URL to Update PHP page. */
+						' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
+						esc_url( wp_get_update_php_url() )
 					);
-					if ( current_user_can( 'update_php' ) ) {
-						printf(
-							/* translators: %s: URL to Update PHP page. */
-							' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
-							esc_url( wp_get_update_php_url() )
-						);
-						wp_update_php_annotation( '</p><p><em>', '</em>' );
-					}
+					wp_update_php_annotation( '</p><p><em>', '</em>', false );
 				}
-				?>
-			</p></div>
-		<?php endif; ?>
-	<?php endif; ?>
+			}
+			wp_admin_notice(
+				$theme_update_error,
+				array(
+					'type'               => 'error',
+					'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ),
+				)
+			);
+		endif;
+	endif;
 
-	<?php
 	if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) {
-		echo '<div class="notice inline notice-error notice-alt"><p>';
+		$message = '';
 		if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) {
-			_e( 'This theme does not work with your versions of WordPress and PHP.' );
+			$message = __( 'This theme does not work with your versions of WordPress and PHP.' );
 			if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
-				printf(
+				$message .= sprintf(
 					/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
 					' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
 					self_admin_url( 'update-core.php' ),
 					esc_url( wp_get_update_php_url() )
 				);
-				wp_update_php_annotation( '</p><p><em>', '</em>' );
+				$message .= wp_update_php_annotation( '</p><p><em>', '</em>', false );
 			} elseif ( current_user_can( 'update_core' ) ) {
-				printf(
+				$message .= sprintf(
 					/* translators: %s: URL to WordPress Updates screen. */
 					' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 					self_admin_url( 'update-core.php' )
 				);
 			} elseif ( current_user_can( 'update_php' ) ) {
-				printf(
+				$message .= sprintf(
 					/* translators: %s: URL to Update PHP page. */
 					' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 					esc_url( wp_get_update_php_url() )
 				);
-				wp_update_php_annotation( '</p><p><em>', '</em>' );
+				$message .= wp_update_php_annotation( '</p><p><em>', '</em>', false );
 			}
 		} elseif ( ! $theme['compatibleWP'] ) {
-			_e( 'This theme does not work with your version of WordPress.' );
+			$message .= __( 'This theme does not work with your version of WordPress.' );
 			if ( current_user_can( 'update_core' ) ) {
-				printf(
+				$message .= sprintf(
 					/* translators: %s: URL to WordPress Updates screen. */
 					' ' . __( '<a href="%s">Please update WordPress</a>.' ),
 					self_admin_url( 'update-core.php' )
 				);
 			}
 		} elseif ( ! $theme['compatiblePHP'] ) {
-			_e( 'This theme does not work with your version of PHP.' );
+			$message .= __( 'This theme does not work with your version of PHP.' );
 			if ( current_user_can( 'update_php' ) ) {
-				printf(
+				$message .= sprintf(
 					/* translators: %s: URL to Update PHP page. */
 					' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
 					esc_url( wp_get_update_php_url() )
 				);
-				wp_update_php_annotation( '</p><p><em>', '</em>' );
+				$message .= wp_update_php_annotation( '</p><p><em>', '</em>', false );
 			}
 		}
-		echo '</p></div>';
+
+		wp_admin_notice(
+			$message,
+			array(
+				'type'               => 'error',
+				'additional_classes' => array( 'inline', 'notice-alt' ),
+			)
+		);
 	}
-	?>
 
-	<?php
 	/* translators: %s: Theme name. */
 	$details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), $theme['name'] );
 	?>
@@ -555,7 +616,8 @@
 			?>
 			<a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
 			<?php
-			if ( ! $theme['blockTheme'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
+			// Only classic themes require the "customize" capability.
+			if ( current_user_can( 'edit_theme_options' ) && ( $theme['blockTheme'] || current_user_can( 'customize' ) ) ) {
 				/* translators: %s: Theme name. */
 				$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
 				?>
@@ -611,7 +673,9 @@
 			<td></td>
 		<?php } ?>
 	</tr>
-	<?php foreach ( $broken_themes as $broken_theme ) : ?>
+	<?php
+	foreach ( $broken_themes as $broken_theme ) :
+		?>
 		<tr>
 			<td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : esc_html( $broken_theme->get_stylesheet() ); ?></td>
 			<td><?php echo $broken_theme->errors()->get_error_message(); ?></td>
@@ -672,7 +736,9 @@
 			}
 			?>
 		</tr>
-	<?php endforeach; ?>
+		<?php
+	endforeach;
+	?>
 </table>
 </div>
 
@@ -691,6 +757,13 @@
  * @return string The template for displaying the auto-update setting link.
  */
 function wp_theme_auto_update_setting_template() {
+	$notice   = wp_get_admin_notice(
+		'',
+		array(
+			'type'               => 'error',
+			'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
+		)
+	);
 	$template = '
 		<div class="theme-autoupdate">
 			<# if ( data.autoupdate.supported ) { #>
@@ -716,7 +789,7 @@
 				<# } #>
 				<br />' . wp_get_auto_update_message() . '</span>
 			<# } #>
-			<div class="notice notice-error notice-alt inline hidden"><p></p></div>
+			' . $notice . '
 		</div>
 	';
 
@@ -914,13 +987,11 @@
 					$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>
-					<# if ( ! data.blockTheme ) { #>
-						<?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>
-					<# } #>
+					<?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. */
@@ -940,9 +1011,24 @@
 	<div class="theme-backdrop"></div>
 	<div class="theme-wrap wp-clearfix" role="document">
 		<div class="theme-header">
-			<button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button>
-			<button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button>
-			<button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button>
+			<button class="left dashicons dashicons-no"><span class="screen-reader-text">
+				<?php
+				/* translators: Hidden accessibility text. */
+				_e( 'Show previous theme' );
+				?>
+			</span></button>
+			<button class="right dashicons dashicons-no"><span class="screen-reader-text">
+				<?php
+				/* translators: Hidden accessibility text. */
+				_e( 'Show next theme' );
+				?>
+			</span></button>
+			<button class="close dashicons dashicons-no"><span class="screen-reader-text">
+				<?php
+				/* translators: Hidden accessibility text. */
+				_e( 'Close details dialog' );
+				?>
+			</span></button>
 		</div>
 		<div class="theme-about wp-clearfix">
 			<div class="theme-screenshots">
@@ -1134,23 +1220,23 @@
 					/* translators: %s: Theme name. */
 					$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
 					?>
+					<# if ( ! data.blockTheme ) { #>
+						<a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
+					<# } #>
 					<# if ( data.actions.activate ) { #>
 						<a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
 					<# } #>
-					<# if ( ! data.blockTheme ) { #>
-						<a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
-					<# } #>
 				<# } else { #>
 					<?php
 					/* translators: %s: Theme name. */
 					$aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
 					?>
+					<# if ( ! data.blockTheme ) { #>
+						<a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
+					<# } #>
 					<# if ( data.actions.activate ) { #>
 						<a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
 					<# } #>
-					<# if ( ! data.blockTheme ) { #>
-						<a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
-					<# } #>
 				<# } #>
 			</div>