From eb003e337d3a538cefba1bb947e9df2f51eb0cb8 Mon Sep 17 00:00:00 2001 From: Sayed Taqui Date: Tue, 21 Mar 2017 20:19:27 +0530 Subject: [PATCH] Revert the previewingTheme value. --- php/class-customize-snapshot-manager-back-compat.php | 3 ++- php/class-customize-snapshot-manager.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/php/class-customize-snapshot-manager-back-compat.php b/php/class-customize-snapshot-manager-back-compat.php index c79957b3..f49d7212 100644 --- a/php/class-customize-snapshot-manager-back-compat.php +++ b/php/class-customize-snapshot-manager-back-compat.php @@ -87,6 +87,7 @@ public function enqueue_controls_scripts() { if ( $this->snapshot ) { $post = $this->snapshot->post(); $this->override_post_date_default_data( $post ); + $preview_url_query_vars = $this->post_type->get_customizer_state_query_vars( $post->ID ); } // Script data array. @@ -101,7 +102,7 @@ public function enqueue_controls_scripts() { 'initialServerDate' => current_time( 'mysql', false ), 'initialServerTimestamp' => floor( microtime( true ) * 1000 ), 'theme' => $this->original_stylesheet, - 'previewingTheme' => ! $this->customize_manager->is_theme_active(), + 'previewingTheme' => isset( $preview_url_query_vars['theme'] ) ? $preview_url_query_vars['theme'] : '', 'i18n' => array( 'saveButton' => __( 'Save', 'customize-snapshots' ), 'updateButton' => __( 'Update', 'customize-snapshots' ), diff --git a/php/class-customize-snapshot-manager.php b/php/class-customize-snapshot-manager.php index 03b23921..cd8197f1 100644 --- a/php/class-customize-snapshot-manager.php +++ b/php/class-customize-snapshot-manager.php @@ -274,6 +274,7 @@ public function enqueue_controls_scripts() { if ( $this->snapshot ) { $post_id = $this->customize_manager->changeset_post_id(); $post = get_post( $post_id ); + $preview_url_query_vars = $this->post_type->get_customizer_state_query_vars( $post->ID ); if ( $post instanceof \WP_Post ) { $this->override_post_date_default_data( $post ); $edit_link = $this->snapshot->get_edit_link( $post ); @@ -289,7 +290,7 @@ public function enqueue_controls_scripts() { 'currentUserCanPublish' => current_user_can( 'customize_publish' ), 'initialServerDate' => current_time( 'mysql', false ), 'initialServerTimestamp' => floor( microtime( true ) * 1000 ), - 'previewingTheme' => ! $this->customize_manager->is_theme_active(), + 'previewingTheme' => isset( $preview_url_query_vars['theme'] ) ? $preview_url_query_vars['theme'] : '', 'i18n' => array( 'saveButton' => __( 'Save', 'customize-snapshots' ), 'updateButton' => __( 'Update', 'customize-snapshots' ),