diff --git a/wp-includes/class-wp-customize-section.php b/wp-includes/class-wp-customize-section.php
index 78b3de9fd..21f751a49 100644
--- a/wp-includes/class-wp-customize-section.php
+++ b/wp-includes/class-wp-customize-section.php
@@ -83,11 +83,10 @@ class WP_Customize_Section {
title ); ?>
- settings as $setting ) : ?>
- -
- maybe_render(); ?>
-
-
+ settings as $setting )
+ $setting->maybe_render();
+ ?>
render_content().
*
* @since 3.4.0
*/
protected function render() {
+
+ $id = 'customize-control-' . $this->id;
+ $class = 'customize-control customize-control-' . $this->control;
+
+ $style = '';
+ if ( $this->visibility ) {
+ $visibility_setting = $this->manager->get_setting( $this->visibility[0] );
+ $visibility_value = isset( $this->visibility[1] ) ? $this->visibility[1] : true;
+
+ if ( $visibility_setting && $visibility_value != $visibility_setting->value() )
+ $style = 'style="display:none;"';
+ }
+
+ ?>>
+ render_content(); ?>
+ control ) {
case 'text':
?>
diff --git a/wp-includes/class-wp-customize.php b/wp-includes/class-wp-customize.php
index 5b64d7644..2bba95663 100644
--- a/wp-includes/class-wp-customize.php
+++ b/wp-includes/class-wp-customize.php
@@ -618,7 +618,7 @@ final class WP_Customize {
'choices' => $choices,
'default' => get_option( 'show_on_front' ),
'type' => 'option',
- 'capability' => 'manage_options'
+ 'capability' => 'manage_options',
) );
$this->add_setting( 'page_on_front', array(
@@ -627,7 +627,8 @@ final class WP_Customize {
'section' => 'static_front_page',
'control' => 'dropdown-pages',
'type' => 'option',
- 'capability' => 'manage_options'
+ 'capability' => 'manage_options',
+ 'visibility' => array( 'show_on_front', 'page' ),
) );
$this->add_setting( 'page_for_posts', array(
@@ -636,7 +637,8 @@ final class WP_Customize {
'section' => 'static_front_page',
'control' => 'dropdown-pages',
'type' => 'option',
- 'capability' => 'manage_options'
+ 'capability' => 'manage_options',
+ 'visibility' => array( 'show_on_front', 'page' ),
) );
/* Site Title & Tagline */
@@ -650,7 +652,7 @@ final class WP_Customize {
'section' => 'strings',
'default' => get_option( 'blogname' ),
'type' => 'option',
- 'capability' => 'manage_options'
+ 'capability' => 'manage_options',
) );
$this->add_setting( 'blogdescription', array(
@@ -658,7 +660,7 @@ final class WP_Customize {
'section' => 'strings',
'default' => get_option( 'blogdescription' ),
'type' => 'option',
- 'capability' => 'manage_options'
+ 'capability' => 'manage_options',
) );
}
};
diff --git a/wp-includes/customize-controls.php b/wp-includes/customize-controls.php
index 13f6b6e1a..8de52be33 100644
--- a/wp-includes/customize-controls.php
+++ b/wp-includes/customize-controls.php
@@ -104,6 +104,13 @@ do_action( 'customize_controls_print_scripts' );
'value' => $setting->value(),
'control' => $setting->control,
);
+
+ if ( $setting->visibility ) {
+ $settings['controls'][ $id ]['visibility'] = array(
+ 'id' => $setting->visibility[0],
+ 'value' => isset( $setting->visibility[1] ) ? $setting->visibility[1] : true,
+ );
+ }
}
?>
diff --git a/wp-includes/js/customize-controls.dev.js b/wp-includes/js/customize-controls.dev.js
index c0c9e6974..6688d1f48 100644
--- a/wp-includes/js/customize-controls.dev.js
+++ b/wp-includes/js/customize-controls.dev.js
@@ -230,10 +230,20 @@
});
$.each( api.settings.controls, function( id, data ) {
- var constructor = api.controls[ data.control ] || api.Control;
- api.add( id, new constructor( id, data.value, {
+ var constructor = api.controls[ data.control ] || api.Control,
+ control;
+
+ control = api.add( id, new constructor( id, data.value, {
previewer: previewer
} ) );
+
+ if ( data.visibility ) {
+ api( data.visibility.id, function( other ) {
+ other.bind( function( to ) {
+ control.container.toggle( to == data.visibility.value );
+ });
+ });
+ }
});
// Temporary accordion code.