Skip to main content
Added full function for customizer control register
Source Link

After adding your custom control class, you need to register your control like below code, then you can call your control via JS

function prefix_customize_register( $wp_customize ) {
    $wp_customize->register_control_type( 'TestControl' );
}
add_action( 'customize_register', 'prefix_customize_register' );

Then via JS, like this:

api.control.add(
    new api.Control( 'birthdate', {
      type: 'test-control',
      label: 'Birthdate',
      description: "Someone was born on this day.",
      section: 'my_custom_section',
      includeTime: false,
      setting: new api.Value('2000-01-02')
    })
);

After adding your custom control class, you need to register your control like below code, then you can call your control via JS

$wp_customize->register_control_type( 'TestControl' );

After adding your custom control class, you need to register your control like below code, then you can call your control via JS

function prefix_customize_register( $wp_customize ) {
    $wp_customize->register_control_type( 'TestControl' );
}
add_action( 'customize_register', 'prefix_customize_register' );

Then via JS, like this:

api.control.add(
    new api.Control( 'birthdate', {
      type: 'test-control',
      label: 'Birthdate',
      description: "Someone was born on this day.",
      section: 'my_custom_section',
      includeTime: false,
      setting: new api.Value('2000-01-02')
    })
);
Source Link

After adding your custom control class, you need to register your control like below code, then you can call your control via JS

$wp_customize->register_control_type( 'TestControl' );