Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Get snapshot post id from current post
Browse files Browse the repository at this point in the history
  • Loading branch information
mohdsayed committed Mar 6, 2017
1 parent 6a44a47 commit 95e139b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion js/compat/customize-snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
api.previewer.query = function() {
var retval = originalQuery.apply( this, arguments );

if ( ! _.isUndefined( CustomizerBrowserHistory ) ) {
if ( 'undefined' !== typeof CustomizerBrowserHistory ) {
retval.customize_preview_url_query_vars = JSON.stringify( CustomizerBrowserHistory.getQueryParams( location.href ) );
}

Expand Down
2 changes: 1 addition & 1 deletion js/customize-snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@
api.previewer.query = function() {
var retval = originalQuery.apply( this, arguments );

if ( ! _.isUndefined( CustomizerBrowserHistory ) ) {
if ( 'undefined' !== typeof CustomizerBrowserHistory ) {
retval.customize_preview_url_query_vars = JSON.stringify( CustomizerBrowserHistory.getQueryParams( location.href ) );
}

Expand Down
12 changes: 7 additions & 5 deletions php/class-customize-snapshot-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,15 +525,17 @@ public function replace_customize_link( $wp_admin_bar ) {
);
}

$post_id = $this->post_type->find_post( $this->current_snapshot_uuid );
$preview_url_query_vars = $this->post_type->get_preview_url_query_vars( $post_id );

$args = array(
$this->get_customize_uuid_param() => $this->current_snapshot_uuid,
);

if ( ! empty( $preview_url_query_vars ) ) {
$args = array_merge( $args, $preview_url_query_vars );
$post = $this->snapshot->post();

if ( $post ) {
$preview_url_query_vars = $this->post_type->get_preview_url_query_vars( $post->ID );
if ( ! empty( $preview_url_query_vars ) ) {
$args = array_merge( $args, $preview_url_query_vars );
}
}

// Add customize_snapshot_uuid and preview url params to customize.php itself.
Expand Down

0 comments on commit 95e139b

Please sign in to comment.