generic

The generic control is one of the most versatile controls in Kirki. It allows you to create any HTML input type you want using any attributes you can imagine.

Example

Kirki::add_field( 'theme_config_id', [
	'type'        => 'generic',
	'settings'    => 'generic_custom_setting',
	'label'       => esc_html__( 'Custom input Control.', 'kirki' ),
	'description' => esc_html__( 'The "generic" control allows you to add any input type you want. In this case we use type="password" and define custom styles.', 'kirki' ),
	'section'     => 'section_id',
	'default'     => '',
	'choices'     => [
		'element'  => 'input',
		'type'     => 'password',
		'style'    => 'background-color:black;color:red;',
		'data-foo' => 'bar',
	],
] );

The above code will create this HTML in your control:

<input type="password" style="background-color:black;color:red;" data-foo="bar" />

The data-link is added automatically so your fields will work out of the box.

generic fields are an abstraction of text fields and textarea fields. These child controls internally use the generic control by passing on the appropriate arguments.

Last updated on: May 10th, 2020

Scroll to Top

Download

Subscribe & be the first to be informed about
new features & updates!