Hi, I'm tying to define a class for some controls, so I can style then, but I think Kirki is not working with default 'input_attrs' parameters to define the control class, it's right?
2.3.5
theme_mods
Kirki::add_field( 'my_config', array(
'type' => 'text',
'settings' => 'my_setting',
'label' => __( 'Text Control', 'my_textdomain' ),
'section' => 'my_section',
'default' => esc_attr__( 'This is a defualt value', 'my_textdomain' ),
'priority' => 10,
'input_attrs' => array( 'class' => 'my_custom_class' ),
) );
Here's the customizer api example: https://developer.wordpress.org/themes/advanced-topics/customizer-api/#controls
wow, to be honest I didn't even know about input_attrs.
I have a generic control that you can use until I implement this one... Won't be long, I'll try to get it done in the weekend.
In the meantime here's how you can do it with the existing implementation:
Kirki::add_field( 'my_config', array(
'type' => 'generic',
'settings' => 'my_setting',
'label' => __( 'Text Control', 'my_textdomain' ),
'section' => 'my_section',
'default' => esc_attr__( 'This is a defualt value', 'my_textdomain' ),
'priority' => 10,
'choices' => array(
'element' => 'input',
'type' => 'text',
'class' => 'my-custom-class',
'data-foo' => 'bar',
'placeholder' => 'something',
),
) );
This will basically create this:
<input type="text" class="my-custom-class" data-foo="bar" placeholder="something">
So you can put anything in there... 馃憤
Thanks @aristath, this will be helpfull! (I also didn't know about 'input_attrs' until need it...)
Fixed, will be included in the next release. 馃憤