How to only load CSS when the Option is checked in Theme Customizer in Wordpress?

23 Views Asked by At

New to WP and stuff, and looking for a way to load the CSS only when the Option is checked. I used the below code to add in the Control in Theme Customizer, but not sure how to load the CSS only when the option is checked:

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'enable_boxed_layout', array(
        'label'   => esc_html__( 'Enable Boxed Layout', 'Divi' ),
        'type'    => 'checkbox',
        'section'  => 'accent_theme',
        'settings' => 'accent_theme_setting'
        
    ) ) );

Any help would be highly appreciated!

0

There are 0 best solutions below