Make WordPress Core


Ignore:
Timestamp:
04/22/2015 04:15:01 PM (11 years ago)
Author:
ocean90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r32054 r32265  
    11991199
    12001200        // Theme Controls.
     1201
     1202        // Add a control for the active/original theme.
     1203        if ( ! $this->is_theme_active() ) {
     1204            $themes = wp_prepare_themes_for_js( array( wp_get_theme( $this->original_stylesheet ) ) );
     1205            $active_theme = current( $themes );
     1206            $active_theme['isActiveTheme'] = true;
     1207            $this->add_control( new WP_Customize_Theme_Control( $this, $active_theme['id'], array(
     1208                'theme'    => $active_theme,
     1209                'section'  => 'themes',
     1210                'settings' => 'active_theme',
     1211            ) ) );
     1212        }
     1213
    12011214        $themes = wp_prepare_themes_for_js();
    12021215        foreach ( $themes as $theme ) {
    1203             if ( $theme['active'] ) {
     1216            if ( $theme['active'] || $theme['id'] === $this->original_stylesheet ) {
    12041217                continue;
    12051218            }
    12061219
    12071220            $theme_id = 'theme_' . $theme['id'];
     1221            $theme['isActiveTheme'] = false;
    12081222            $this->add_control( new WP_Customize_Theme_Control( $this, $theme_id, array(
    12091223                'theme'    => $theme,
Note: See TracChangeset for help on using the changeset viewer.