mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +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:
@@ -533,15 +533,24 @@ class WP_Customize_Control {
|
||||
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $dropdown = wp_dropdown_pages(
|
||||
<?php
|
||||
$dropdown_name = '_customize-dropdown-pages-' . $this->id;
|
||||
$show_option_none = __( '— Select —' );
|
||||
$option_none_value = '0';
|
||||
$dropdown = wp_dropdown_pages(
|
||||
array(
|
||||
'name' => '_customize-dropdown-pages-' . $this->id,
|
||||
'name' => $dropdown_name,
|
||||
'echo' => 0,
|
||||
'show_option_none' => __( '— Select —' ),
|
||||
'option_none_value' => '0',
|
||||
'show_option_none' => $show_option_none,
|
||||
'option_none_value' => $option_none_value,
|
||||
'selected' => $this->value(),
|
||||
)
|
||||
);
|
||||
if ( empty( $dropdown ) ) {
|
||||
$dropdown = sprintf( '<select id="%1$s" name="%1$s">', esc_attr( $dropdown_name ) );
|
||||
$dropdown .= sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $option_none_value ), esc_html( $show_option_none ) );
|
||||
$dropdown .= '</select>';
|
||||
}
|
||||
|
||||
// Hackily add in the data link parameter.
|
||||
$dropdown = str_replace( '<select', '<select ' . $this->get_link(), $dropdown );
|
||||
|
||||
Reference in New Issue
Block a user