1

What I'm trying to achieve is to add new args ( output ) as below:

$wp_customize->add_setting(
    'modular_header_main_border_bottom_color', array(
        'default'    => '#e9ecef',
        'capability' => 'edit_theme_options',
        'output'     => array(
            array(
                'element'  => 'body',
                'property' => 'background-color',
            ),
        ),
    )
);

And, get output array in front and enqueue it as a valid CSS. Till now, I've tried achieve the same using customize_dynamic_setting_args hook which works fine in Customizer. But the problem is data from it is not accessible in frontend. https://pastebin.com/AEdmPJDV

I guess there should be another way of doing same.

1

This might be what you are looking for

$args = array(
    'default'    => '#e9ecef',
    'capability' => 'edit_theme_options',
);

if ( something() ) {
    $args['output'] = array(
        array(
            'element'  => 'body',
            'property' => 'background-color',
        ),
    );
}

$wp_customize->add_setting( 'modular_header_main_border_bottom_color', $args );

We are first creating an array for arguments. Later we are pushing a key value to that array with some conditions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.