• I’m building a WordPress theme and need to add custom controls in the customizer, the input field is showing up but when I change the value of input nothing happens.

    Here is my code.

    class WP_Customize_Custom_Control extends WP_Customize_Control {
    public $type = ‘custom_control’;

    function render_content(){
    }
    public function content_template() {
    ?>
    <input type=”text” id=”custom_control” name=”custom_control” />
    <?php
    }
    }

    function company_customize_register( $wp_customize ){
    $wp_customize->register_control_type( ‘WP_Customize_Custom_Control’ );
    $wp_customize->add_setting(‘custom_smthing’, array( ‘default’ => get_theme_mod( “custom_smthing” ), ‘transport’ =>’refresh’ ) );
    $wp_customize->add_control(new WP_Customize_Custom_Control($wp_customize,’custom_smthing’,
    array(
    ‘label’ => __( ‘Custom Control’, ‘company’ ),
    ‘section’ => ‘body_backgrounds’,
    ‘settings’ => ‘custom_smthing’,
    )
    )
    );
    }
    add_action( ‘customize_register’, ‘company_customize_register’ );

  • The topic ‘Customizer custom control transport refresh’ is closed to new replies.