WP_Customize_Date_Time_Control
- Since
- 4.9.0
- Source
wp-includes/customize/class-wp-customize-date-time-control.php:17
Customize Date Time Control class.
Compatibility
- WordPress
- since 4.9.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Properties · 6
$typestringpublic- Customize control type.
$min_yearintpublic- Minimum Year.
$max_yearintpublic- Maximum Year.
$allow_past_dateboolpublic- Allow past date, if set to false user can only select future date.
$include_timeboolpublic- Whether hours, minutes, and meridian should be shown.
$twelve_hour_formatboolpublic- If set to false the control will appear in 24 hour format, the value will still be saved in Y-m-d H:i:s format.
Methods · 6
- render_content()Don't render the control's content - it's rendered with a JS template.
- json()Export data to JS.
- content_template()Renders a JS template for the content of date time control.
- get_month_choices()Generate options for the month Select.
- get_timezone_info()Get timezone info.
- format_gmt_offset()Format GMT Offset.
Source code
class WP_Customize_Date_Time_Control extends WP_Customize_Control { /** * Customize control type. * * @since 4.9.0 * @var string */ public $type = 'date_time'; /** * Minimum Year. * * @since 4.9.0 * @var int */ public $min_year = 1000; /** * Maximum Year. * * @since 4.9.0 * @var int */ public $max_year = 9999; /** * Allow past date, if set to false user can only select future date. * * @since 4.9.0 * @var bool */ public $allow_past_date = true; /** * Whether hours, minutes, and meridian should be shown. * * @since 4.9.0 * @var bool */ public $include_time = true; /** * If set to false the control will appear in 24 hour format, * the value will still be saved in Y-m-d H:i:s format. * * @since 4.9.0 * @var bool */ public $twelve_hour_format = true; /** * Don't render the control's content - it's rendered with a JS template. * * @since 4.9.0 */ public function render_content() {} /** * Export data to JS. * * @since 4.9.0 * @return array */ public function json() { $data = parent::json(); $data['maxYear'] = (int) $this->max_year; $data['minYear'] = (int) $this->min_year; $data['allowPastDate'] = (bool) $this->allow_past_date; $data['twelveHourFormat'] = (bool) $this->twelve_hour_format; $data['includeTime'] = (bool) $this->include_time; return $data; } /** * Renders a JS template for the content of date time control. * * @since 4.9.0Changelog
Introduced in 4.9.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/customize/class-wp-customize-date-time-control.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.