mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 06:37:06 +00:00
Customize: Let static_front_page section be contextually active based on whether there are any published pages.
If there are no pages when the customizer is opened, the `static_front_page` section will be hidden. As soon as a page is created in the customizer session, the `static_front_page` section will be revealed. Previously the section would not be registered if there were no pages. Page stubs created via nav menus will appear in the `dropdown-pages` controls for `page_for_posts` and `page_on_front`, and such page stubs will thus cause the `static_front_page` section to appear. Plugins that facilitate page creation in the customizer by filtering `get_pages` will also cause the section to appear. See #34923. Fixes #38013. git-svn-id: https://develop.svn.wordpress.org/trunk@38624 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -104,6 +104,23 @@
|
||||
deferred.resolve( response );
|
||||
api.Menus.insertedAutoDrafts.push( response.post_id );
|
||||
api( 'nav_menus_created_posts' ).set( _.clone( api.Menus.insertedAutoDrafts ) );
|
||||
|
||||
if ( 'page' === params.post_type ) {
|
||||
|
||||
// Activate static front page controls as this could be the first page created.
|
||||
if ( api.section.has( 'static_front_page' ) ) {
|
||||
api.section( 'static_front_page' ).activate();
|
||||
}
|
||||
|
||||
// Add new page to dropdown-pages controls.
|
||||
api.control.each( function( control ) {
|
||||
var select;
|
||||
if ( 'dropdown-pages' === control.params.type ) {
|
||||
select = control.container.find( 'select[name^="_customize-dropdown-pages-"]' );
|
||||
select.append( new Option( params.post_title, response.post_id ) );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user