Time Picker

The time-picker lets you add a time picker field.

Time Picker

Parameters

Here are the parameters in adding time-picker.

id
string | required

a unique slug-like string to use as an id and also as index in saving data in database.

label
string | optional

the label of the field.

description
string | optional

the description of the field and display under the label.

section
string | required

the section where the field will be displayed.

default
string | optional

the default value of the field.

priority
integer | optional

determines the order of fields in section.

placeholder
string | optional

display placeholder in field.

military_format
boolean | optional | default : false

set if the time picker will be in military time format.

Note

  1. The value will return string and in military format.
  2. Default format must be in correct format "H:i" examples: 01:01, 12:30, 23:08 and also set as military time.

Example


Yano::field( 'time-picker', [
   'id'          => 'timepickerdb1',
   'label'       => 'Set The Time',
   'description' => 'Please add time you want.',
   'section'     => 'section_id',
   'placeholder' => 'Time',
   'priority'    => 1
] );

Example with default and military_format.


Yano::field( 'time-picker', [
   'id'              => 'timepickerdb1',
   'label'           => 'Set The Time',
   'description'     => 'Please add time you want.',
   'section'         => 'section_id',
   'default'         => '01:00',
   'military_format' => true,
   'placeholder'     => 'Time',
   'priority'        => 1
] );

Usage

The get_theme_mod() function is recommended to retrieve data.


// Return a string
echo get_theme_mod('timepickerdb1');