Launch Offer – Kirki PRO is now available! 🚀Get it while it lasts!

Dimension

The Dimension control allows you create an input field where users can enter any valid dimension CSS value. It automatically detects invalid values and notifies the user when that happens.

Example

new \Kirki\Field\Dimension(
	[
		'settings'    => 'dimension_setting',
		'label'       => esc_html__( 'Dimension Control', 'kirki' ),
		'description' => esc_html__( 'A simple dimension control.', 'kirki' ),
		'section'     => 'section_id',
		'default'     => '10px',
		'choices'     => [
			'accept_unitless' => true,
		],
	]
);

Usage

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

Last updated on: January 21st, 2022

Scroll to Top

Download

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