WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Class Reference/WP Customize Control

This class is used with the Theme Customization API to render an input control on the Theme Customizer in WordPress 3.4 or newer.

$wp_customize->add_control(
    new WP_Customize_Control(
        $wp_customize,
        'your_setting_id',
        array(
            'label'          => __( 'Dark or light theme version?', 'theme_name' ),
            'section'        => 'your_section_id',
            'settings'       => 'your_setting_id',
            'type'           => 'radio',
            'choices'        => array(
                'dark'   => __( 'Dark' ),
                'light'  => __( 'Light' )
            )
        )
    )
);

Input Types

With this class you can create the following input types:

  • text (default)
  • checkbox
  • radio (requires choices array in $args)
  • select (requires choices array in $args)
  • dropdown-pages
  • textarea (since WordPress 4.0)

Note: Since WordPress 4.0, input types such as 'email', 'url', 'number', 'hidden' and 'date' are supported implicitly as variations of the 'text' input type.

See also index of Class Reference and index of Function Reference.