Radio

Kirki radio control

You can define the available options using the choices argument as seen in the example below.

Example

new \Kirki\Field\Radio(
	[
		'settings'    => 'radio_setting',
		'label'       => esc_html__( 'Radio Control', 'kirki' ),
		'description' => esc_html__( 'Add a description here.', 'kirki' ),
		'section'     => 'section_id',
		'default'     => 'red',
		'priority'    => 10,
		'choices'     => [
			'red'   => esc_html__( 'Red', 'kirki' ),
			'green' => esc_html__( 'Green', 'kirki' ),
			'blue'  => esc_html__( 'Blue', 'kirki' ),

		],
	]
);
Kirki Radio control Advanced

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

new \Kirki\Field\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' ),
			],
		],
	]
);

Was this helpful?