mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
Theme Switcher: Provide an easier way to reset back to the current active theme.
* Add control for the active theme when doing a theme preview * Highlight an active theme and move it to the top props valendesigns, ocean90. fixes #32002. git-svn-id: https://develop.svn.wordpress.org/trunk@32265 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1243,10 +1243,16 @@ class WP_Customize_Theme_Control extends WP_Customize_Control {
|
||||
*/
|
||||
public function content_template() {
|
||||
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
|
||||
$active_url = esc_url( remove_query_arg( 'theme', $current_url ) );
|
||||
$preview_url = esc_url( add_query_arg( 'theme', '__THEME__', $current_url ) ); // Token because esc_url() strips curly braces.
|
||||
$preview_url = str_replace( '__THEME__', '{{ data.theme.id }}', $preview_url );
|
||||
?>
|
||||
<div class="theme" tabindex="0" data-preview-url="<?php echo esc_attr( $preview_url ); ?>" aria-describedby="{{ data.theme.id }}-action {{ data.theme.id }}-name">
|
||||
<# if ( data.theme.isActiveTheme ) { #>
|
||||
<div class="theme active" tabindex="0" data-preview-url="<?php echo esc_attr( $active_url ); ?>" aria-describedby="{{ data.theme.id }}-action {{ data.theme.id }}-name">
|
||||
<# } else { #>
|
||||
<div class="theme" tabindex="0" data-preview-url="<?php echo esc_attr( $preview_url ); ?>" aria-describedby="{{ data.theme.id }}-action {{ data.theme.id }}-name">
|
||||
<# } #>
|
||||
|
||||
<# if ( data.theme.screenshot[0] ) { #>
|
||||
<div class="theme-screenshot">
|
||||
<img data-src="{{ data.theme.screenshot[0] }}" alt="" />
|
||||
@@ -1254,14 +1260,28 @@ class WP_Customize_Theme_Control extends WP_Customize_Control {
|
||||
<# } else { #>
|
||||
<div class="theme-screenshot blank"></div>
|
||||
<# } #>
|
||||
<span class="more-details" id="{{ data.theme.id }}-action"><?php _e( 'Live Preview' ); ?></span>
|
||||
|
||||
<# if ( data.theme.isActiveTheme ) { #>
|
||||
<span class="more-details" id="{{ data.theme.id }}-action"><?php _e( 'Customize' ); ?></span>
|
||||
<# } else { #>
|
||||
<span class="more-details" id="{{ data.theme.id }}-action"><?php _e( 'Live Preview' ); ?></span>
|
||||
<# } #>
|
||||
|
||||
<div class="theme-author"><?php printf( __( 'By %s' ), '{{ data.theme.author }}' ); ?></div>
|
||||
|
||||
<h3 class="theme-name" id="{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
|
||||
|
||||
<div class="theme-actions">
|
||||
<button type="button" class="button theme-details"><?php _e( 'Theme Details' ); ?></button>
|
||||
</div>
|
||||
<# if ( data.theme.isActiveTheme ) { #>
|
||||
<h3 class="theme-name" id="{{ data.theme.id }}-name">
|
||||
<?php
|
||||
/* translators: %s: theme name */
|
||||
printf( __( '<span>Active:</span> %s' ), '{{ data.theme.name }}' );
|
||||
?>
|
||||
</h3>
|
||||
<# } else { #>
|
||||
<h3 class="theme-name" id="{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
|
||||
<div class="theme-actions">
|
||||
<button type="button" class="button theme-details"><?php _e( 'Theme Details' ); ?></button>
|
||||
</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user