Number

Kirki Number

Number controls are simple numeric fields that only accept numeric values. You can pass a min, a max and a step value in the choices argument.

Example

new \Kirki\Field\Number(
	[
		'settings' => 'number_setting',
		'label'    => esc_html__( 'Number Control', 'kirki' ),
		'section'  => 'section_id',
		'default'  => 42,
		'choices'  => [
			'min'  => -10,
			'max'  => 80,
			'step' => 1,
		],
	]
);

Usage

<div style="font-size: <?php echo get_theme_mod( 'number_setting', 42 ); ?>px">
	<p>The font-size of this paragraph is controlled by "number_setting".</p>
</div>

Was this helpful?