I have a radio box and an image setting in functions.php:
Spotlight_Kirki::add_field( 'spotlight_config', array(
'type' => 'radio',
'settings' => 'spotlight_layout_type',
'label' => esc_html__( 'Layout Type' , 'spotlight' ),
'section' => 'spotlight_general',
'default' => 'layout_dark',
'priority' => 0,
'choices' => array(
'dark' => esc_html__( 'Dark version', 'spotlight' ),
'light' => esc_html__( 'Light version', 'spotlight' ),
'coloured' => esc_html__( 'Coloured version', 'spotlight' ),
),
) );
if ( get_theme_mod( 'spotlight_layout_type', '' ) != 'coloured' ) {
Spotlight_Kirki::add_field( 'spotlight_config', array(
'type' => 'image',
'settings' => 'spotlight_bg_image',
'label' => esc_html__( 'Background Image' , 'spotlight' ),
'section' => 'spotlight_general',
'default' => esc_html__( '', 'spotlight' ),
'priority' => 0
) );
}
So, as you can see, I tried to enable the spotlight_bg_image
setting only if the previous radio box was set to anything but coloured
. However, it doesn't get hidden when I choose one. Any help would be appreciated.