Toggles provide a simple way to turn options on or off. They return a boolean
which makes it easy for developers to build logic around those types of controls.
Toggle controls are making use of the Checkbox
control. They are simply styled differently.
Example
Kirki::add_field(
[
'settings' => 'toggle_setting',
'label' => esc_html__( 'This is the label', 'kirki' ),
'section' => 'section_id',
'default' => '1',
'priority' => 10,
]
);
Usage
<?php if ( true == get_theme_mod( 'toggle_setting', true ) ) : ?>
<p>Toggle is enabled</p>
<?php else : ?>
<p>Toggle is disabled</p>
<?php endif; ?>