Core controls include ‘text’, ‘checkbox’, ‘textarea’, ‘radio’, ‘select’, and ‘dropdown-pages’. Additional input types such as ’email’, ‘url’, ‘number’, ‘hidden’, and ‘date’ are supported implicitly. Default ‘text’.
See Customizer Objects and WP_Customize_Control for more information.
<?php
/**
* Customizer
*
* @package ClientName
* @author Bill Erickson
* @since 1.0.0
* @license GPL-2.0+
**/
class EA_Customizer {
public function __construct() {
add_action( 'customize_register', array( $this, 'customize_register' ) );
}
/**
* Register customizer setting
*
*/
function customize_register( $wp_customize ) {
$wp_customize->add_section( 'ea_theme_settings', array(
'title' => __( 'Theme Settings', 'ea' )
));
$wp_customize->add_setting( 'ea_single_video_ad' );
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ea_single_video_ad',
array(
'label' => __('Show Video Ad', 'ea'),
'section' => 'ea_theme_settings',
'settings' => 'ea_single_video_ad',
'type' => 'checkbox',
)
)
);
}
}
new EA_Customizer();