Class Reference/WP Customize Manager/add control
Displays a new controller on the Theme Customization admin screen (available in WordPress 3.4 or newer). Controls serve two purposes: they create a "physical" control that allows a user to manipulate a setting, and it also binds a pre-defined setting to a pre-defined section.
This is a method of the WP_Customize_Manager() class and can only be accessed through the
$wp_customize object within the customize_register action hook.
- (mixed) (required) A string or a specific customization controller object.
- Default: None
- (array) (required) Not used if $id is a control object, otherwise an instance of WP_Customize_Control() (plain text) is created using the specified arguments.
- Default: None
- Creates a control that allows users to enter plain text. This is also the parent class for the classes that follow.
- Creates a control that allows users to select a color from a color wheel.
- Creates a control that allows users to upload media.
- Creates a control that allows users to select or upload an image.
- Creates a control that allows users to select a new background image.
- Creates a control that allows users to select a new header image.
Custom controls can also be created. For more information, see this post on Ottopress.com
Remember that this example assumes you are already working within the customize_register action hook.
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array(
'label' => __( 'Header Color', 'mytheme' ),
'section' => 'your_section_id',
'settings' => 'your_setting_id',
) ) );