diff --git a/wp-includes/class-wp-customize-control.php b/wp-includes/class-wp-customize-control.php
index 785bfe932..e35197c9b 100644
--- a/wp-includes/class-wp-customize-control.php
+++ b/wp-includes/class-wp-customize-control.php
@@ -22,8 +22,6 @@ class WP_Customize_Control {
public $json = array();
- public $visibility;
-
public $type = 'text';
@@ -102,21 +100,6 @@ class WP_Customize_Control {
}
$this->json['type'] = $this->type;
-
- if ( $this->visibility ) {
- if ( is_string( $this->visibility ) ) {
- $this->json['visibility'] = array(
- 'id' => $this->visibility,
- 'value' => true,
- );
- } else {
- $this->json['visibility'] = array(
- 'id' => $this->visibility[0],
- 'value' => $this->visibility[1],
- );
- }
-
- }
}
/**
@@ -163,22 +146,7 @@ class WP_Customize_Control {
$id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) );
$class = 'customize-control customize-control-' . $this->type;
- $style = '';
- if ( $this->visibility ) {
- if ( is_string( $this->visibility ) ) {
- $visibility_id = $this->visibility;
- $visibility_value = true;
- } else {
- $visibility_id = $this->visibility[0];
- $visibility_value = $this->visibility[1];
- }
- $visibility_setting = $this->manager->get_setting( $visibility_id );
-
- if ( $visibility_setting && $visibility_value != $visibility_setting->value() )
- $style = 'style="display:none;"';
- }
-
- ?>
>
+ ?>
render_content(); ?>
add_control( 'background_repeat', array(
'label' => __( 'Background Repeat' ),
'section' => 'background',
- 'visibility' => 'background_image',
'type' => 'radio',
'choices' => array(
'no-repeat' => __('No Repeat'),
@@ -609,7 +608,6 @@ final class WP_Customize {
$this->add_control( 'background_position_x', array(
'label' => __( 'Background Position' ),
'section' => 'background',
- 'visibility' => 'background_image',
'type' => 'radio',
'choices' => array(
'left' => __('Left'),
@@ -626,7 +624,6 @@ final class WP_Customize {
$this->add_control( 'background_attachment', array(
'label' => __( 'Background Attachment' ),
'section' => 'background',
- 'visibility' => 'background_image',
'type' => 'radio',
'choices' => array(
'fixed' => __('Fixed'),
@@ -708,7 +705,6 @@ final class WP_Customize {
'label' => __( 'Front page' ),
'section' => 'static_front_page',
'type' => 'dropdown-pages',
- 'visibility' => array( 'show_on_front', 'page' ),
) );
$this->add_setting( 'page_for_posts', array(
@@ -721,7 +717,6 @@ final class WP_Customize {
'label' => __( 'Posts page' ),
'section' => 'static_front_page',
'type' => 'dropdown-pages',
- 'visibility' => array( 'show_on_front', 'page' ),
) );
/* Site Title & Tagline */
diff --git a/wp-includes/js/customize-controls.dev.js b/wp-includes/js/customize-controls.dev.js
index ab4a0d449..a1bc44b68 100644
--- a/wp-includes/js/customize-controls.dev.js
+++ b/wp-includes/js/customize-controls.dev.js
@@ -377,20 +377,6 @@
params: data,
previewer: previewer
} ) );
-
- if ( data.visibility ) {
- api( data.visibility.id, function( other ) {
- if ( 'boolean' === typeof data.visibility.value ) {
- other.bind( function( to ) {
- control.container.toggle( !! to == data.visibility.value );
- });
- } else {
- other.bind( function( to ) {
- control.container.toggle( to == data.visibility.value );
- });
- }
- });
- }
});
// Temporary accordion code.
@@ -415,6 +401,36 @@
setting.method = 'postMessage';
});
+ // Control visibility for default controls
+ $.each({
+ 'background_image': {
+ controls: [ 'background_repeat', 'background_position_x', 'background_attachment' ],
+ callback: function( to ) { return !! to }
+ },
+ 'show_on_front': {
+ controls: [ 'page_on_front', 'page_for_posts' ],
+ callback: function( to ) { return 'page' === to }
+ },
+ 'header_textcolor': {
+ controls: [ 'header_textcolor' ],
+ callback: function( to ) { return 'blank' !== to }
+ }
+ }, function( settingId, o ) {
+ api( settingId, function( setting ) {
+ $.each( o.controls, function( i, controlId ) {
+ api.control( controlId, function( control ) {
+ var visibility = function( to ) {
+ control.container.toggle( o.callback( to ) );
+ };
+
+ visibility( setting.get() );
+ setting.bind( visibility );
+ });
+ });
+ });
+ });
+
+ // Juggle the two controls that use header_textcolor
api.control( 'display_header_text', function( control ) {
var last = '';