radio

You can define the available options using the choices argument and formating them as an array key => label.

Example

Kirki::add_field( 'theme_config_id', [
	'type'        => 'radio',
	'settings'    => 'radio_setting',
	'label'       => esc_html__( 'Radio Control', 'kirki' ),
	'section'     => 'section_id',
	'default'     => 'red',
	'priority'    => 10,
	'choices'     => [
		'red'   => esc_html__( 'Red', 'kirki' ),
		'green' => esc_html__( 'Green', 'kirki' ),
		'blue'  => esc_html__( 'Blue', 'kirki' ),
	],
] );

In case you need to add additional, extra-long descriptions to your radio options you can use a format like this:

Kirki::add_field( 'theme_config_id', [
	'type'        => 'radio',
	'settings'    => 'radio_setting_2',
	'label'       => esc_html__( 'Radio Control', 'kirki' ),
	'section'     => 'section_id',
	'default'     => 'red',
	'priority'    => 10,
	'choices'     => [
		'red'   => [
			esc_html__( 'Red', 'kirki' ),
			esc_html__( 'These are some extra details about Red', 'kirki' ),
		],
		'green' => [
			esc_html__( 'Green', 'kirki' ),
			esc_html__( 'These are some extra details about Green', 'kirki' ),
		],
		'blue'  => [
			esc_html__( 'Blue', 'kirki' ),
			esc_html__( 'These are some extra details about Blue', 'kirki' ),
		],
	],
] );

Last updated on: May 10th, 2020

Scroll to Top

Download

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