Type => Background not displaying the values.
Hello,
I tried the instructions below but still not working.
The "background" controls are virtual and are not saved in the db. Background controls have sub-controls:
header_background_color header_background_image header_background_repeat header_background_size header_background_attach header_background_position
So instead of this: get_theme_mod( 'header_background' ) if you want to get the background-color you will have to do this: get_theme_mod( 'header_background_color' )
Here's the code i have declared for the fields.|
$fields[] = array(
'type' => 'background',
'settings' => 'header_background',
'label' => __( 'Choose your header background', 'kirki' ),
'description' => __( '', 'kirki' ),
'section' => 'style_set',
'default' => array(
'color' => 'rgba(25,170,141,0.7)',
'image' => '',
'repeat' => 'no-repeat',
'size' => 'cover',
'attach' => 'fixed',
'position' => 'left-top',
),
);
Thanks,
Ryan
Did you change the controls in the customizer and then save the value?
If you did not, then you need to define a default value in the get_theme_mod() function like this:
$background_color = get_theme_mod( 'header_background_color', 'rgba(25,170,141,0.7)' );
Brilliant. Thank you @aristath appreciate your help.
:) I'm glad I could help!