WordPress Customizer Date Control

Learn how to create a date control using the Kirki Customizer Framework.

Back to Controls

Returnsstring

The date control allows you to select a date.

The returned value is a string.

date control example

Example

<?php
Kirki::add_field( 'theme_config_id', [
	'type'        => 'date',
	'settings'    => 'date_setting',
	'label'       => esc_html__( 'Date Control', 'kirki' ),
	'description' => esc_html__( 'This is a date control.', 'kirki' ),
	'section'     => 'date_section',
	'default'     => '',
] );
?>

Usage

<?php
$date = get_theme_mod( 'date_setting', '2019-01-30' );
echo esc_html( $date );
?>

Can't find what you're looking for? Check the github issues or edit this page to add what's missing.