WordPress Customizer: Using Multiple Customize Settings in Single Control

In a recent WordPress project i worked on, i needed to have an input field and a select dropdown close to each other. Below is a screenshot of what i was looking to achieve. I had two ideas of how i would pull this off but none of them quite frankly pleased me. Here are the ideas and why i used neither.
* Create customize setting and control for the input and select fields since core already has support for input and select fields.
Going this route would have meant not being able add inline style to set the width property of the select dropdown to auto so it doesn’t have an 100% value added by Customizer to virtually every of its core controls.
Adding inline style is possible for input fields using the input_attrs argument.
* Create custom controls for the input and select fields to allow for the flexibility i craved for.
Going this route would have meant writing lots of code (register the customize settings and coding the PHP classes for the custom control for each fields) to achieve something this simple.
Reading the WordPress Customizer documentation, one would think that the standard is: for every customize settings, there can only be one corresponding customize control.
Source: https://managewp.org/articles/14623/wordpress-customizer-using-multiple-customize-settings-in-single-control

Source: https://williechiu40.wordpress.com/2017/03/16/wordpress-customizer-using-multiple-customize-settings-in-single-control/


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s