Background control not working
Issue description:
Background control output only visible during customizer transport. After which output is not saved inline or on external css file.
Further the setting is saved. If I refresh the customizer, the new selected value shows in the color picker, but not on the front end or the customizer preview.
Version used:
3.0.44
Using theme_mods or options?
theme_mod
Code to reproduce the issue (config + field(s))
$config_id = 'gt';
Kirki::add_config( $config_id, array(
'capability' => 'edit_theme_options',
'option_type' => 'theme_mod',
) );
Kirki::add_panel( 'color_panel', array(
'priority' => 4000,
'title' => esc_html__( 'gt Colors', 'gothemes' ),
'description' => esc_html__( 'gt color settings', 'gothemes' ),
) );
Kirki::add_section( 'color__header_section', array(
'title' => esc_html__( 'Header', 'kirki' ),
'panel' => 'color_panel',
'priority' => 400,
) );
Kirki::add_field( $config_id, [
'type' => 'background',
'settings' => 'color__header__background',
'label' => esc_html__( 'Header background', 'kirki' ),
'section' => 'color__header_section',
'default' => [
'background-color' => 'rgba(20,20,20,.8)',
'background-image' => '',
'background-repeat' => 'repeat',
'background-position' => 'center center',
'background-size' => 'cover',
'background-attachment' => 'scroll',
],
'transport' => 'auto',
'output' => [
[
'element' => '.siteheader',
],
],
] );
Are you using the develop or master branch? Or the plugin?
I was using the developer branch. Iv integrated the plugin from WordPress repo now and the issue is not present with that.
Confirmed bug.
Note, even when 'transport' => 'auto', is set, the previewer still refreshes on change.
Fixed
Does this issue fixed? I used kirki from wordpress background not created any css in the front end. Today I downloaded it from github and installed when the customizer is open and in that shows output. But if I open in several tab or others the output shows nothing. The typography control also works when I'm in the customizer but leaving customizer output shows nothing.
Kirki::add_field('servicepages_header', [
'type' => 'background',
'settings' => 'servicepages_settings',
'label' => esc_html__('Background', 'kirki'),
'description' => esc_html__('Background conrols are pretty complex - but extremely useful if properly used.', 'kirki'),
'section' => 'servicepages_setting_section',
'default' => [
'background-color' => 'rgba(20,20,20,.8)',
'background-image' => '',
'background-repeat' => 'repeat',
'background-position' => 'center center',
'background-size' => 'cover',
'background-attachment' => 'scroll',
],
'transport' => 'auto',
'output' => [
[
'element' => '#headerarea',
],
],
]);
@rashed-877 the most likely explanation is that you're probably adding your controls inside a hook instead of directly calling them.
Did you perhaps add them on customize_register or something like that?