Customizer: Improve previewing setting changes for `show_on_front`, `page_on_front`, and `page_for_posts`.
When changing the `page_on_front` setting (with `show_on_front`), change the previewed URL to be the home URL so that the effect can be seen. When changing `page_for_posts`, change the previewed URL to be the selected page. Props valendesigns, westonruter. Fixes #30677. Built from https://develop.svn.wordpress.org/trunk@32976 git-svn-id: http://core.svn.wordpress.org/trunk@32947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
77f385e532
commit
e162bb8940
|
@ -3210,6 +3210,27 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Change previewed URL to the homepage when changing the page_on_front.
|
||||||
|
api( 'show_on_front', 'page_on_front', function( showOnFront, pageOnFront ) {
|
||||||
|
var updatePreviewUrl = function() {
|
||||||
|
if ( showOnFront() === 'page' && parseInt( pageOnFront(), 10 ) > 0 ) {
|
||||||
|
api.previewer.previewUrl.set( api.settings.url.home );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
showOnFront.bind( updatePreviewUrl );
|
||||||
|
pageOnFront.bind( updatePreviewUrl );
|
||||||
|
});
|
||||||
|
|
||||||
|
// Change the previewed URL to the selected page when changing the page_for_posts.
|
||||||
|
api( 'page_for_posts', function( setting ) {
|
||||||
|
setting.bind(function( pageId ) {
|
||||||
|
pageId = parseInt( pageId, 10 );
|
||||||
|
if ( pageId > 0 ) {
|
||||||
|
api.previewer.previewUrl.set( api.settings.url.home + '?page_id=' + pageId );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
api.trigger( 'ready' );
|
api.trigger( 'ready' );
|
||||||
|
|
||||||
// Make sure left column gets focus
|
// Make sure left column gets focus
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.3-alpha-32975';
|
$wp_version = '4.3-alpha-32976';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue