WordPress.org

Make WordPress Core

Ticket #32002: 32002.1.patch

File 32002.1.patch, 2.3 KB (added by ocean90, 5 years ago)
  • src/wp-includes/class-wp-customize-control.php

     
    12451245                $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
    12461246                $preview_url = esc_url( add_query_arg( 'theme', '__THEME__', $current_url ) ); // Token because esc_url() strips curly braces.
    12471247                $preview_url = str_replace( '__THEME__', '{{ data.theme.id }}', $preview_url );
     1248
     1249                // Doesn't work, because $this->theme is empty
     1250                $is_active_theme = $this->theme->stylesheet === $this->manager->original_stylesheet;
    12481251                ?>
    12491252                <div class="theme" tabindex="0" data-preview-url="<?php echo esc_attr( $preview_url ); ?>" aria-describedby="{{ data.theme.id }}-action {{ data.theme.id }}-name">
    12501253                        <# if ( data.theme.screenshot[0] ) { #>
  • src/wp-includes/class-wp-customize-manager.php

     
    3333         *
    3434         * @var string
    3535         */
    36         protected $original_stylesheet;
     36        public $original_stylesheet;
    3737
    3838        /**
    3939         * Whether this is a Customizer pageload.
     
    11981198                require_once( ABSPATH . 'wp-admin/includes/theme.php' );
    11991199
    12001200                // Theme Controls.
     1201
     1202                if ( ! $this->is_theme_active() ) {
     1203                        /*
     1204                         * Add a control for the active/original theme.
     1205                         * The first array element of wp_prepare_themes_for_js() is empty,
     1206                         * because it's reserved for the current theme. But we want
     1207                         * prepared data for just one theme...
     1208                         */
     1209                        $active_theme = current( array_filter( wp_prepare_themes_for_js( array( wp_get_theme( $this->original_stylesheet ) ) ) ) );
     1210                        $this->add_control( new WP_Customize_Theme_Control( $this, $active_theme['id'], array(
     1211                                'theme'    => $active_theme,
     1212                                'section'  => 'themes',
     1213                                'settings' => 'active_theme',
     1214                        ) ) );
     1215                }
     1216
    12011217                $themes = wp_prepare_themes_for_js();
    12021218                foreach ( $themes as $theme ) {
    1203                         if ( $theme['active'] ) {
     1219                        if ( $theme['active'] || $theme['stylesheet'] === $this->original_stylesheet ) {
    12041220                                continue;
    12051221                        }
    12061222