Time

This field type renders a time picker.

Parameters

This type manages time in seconds, so it inherits the Number type.

  • display_format - the displayed time format.

Example

The code below renders a required time picker with the custom_field name, "Custom field" label and "Custom text" placeholder. It displays time in a custom format, e.g. "12:00 AM".

echo ( new HivePress\Fields\Time(
	[
		'name'           => 'custom_field',
		'label'          => 'Custom field',
		'placeholder'    => 'Custom text',
		'display_format' => 'g:i A',
		'required'       => true,
	]
) )->render();

Last updated