Overview
The time field allows you to select a time via a friendly UI. This field uses jQuery UI time picker libraries.
Screenshots
Default:
Time as select dropdowns:
Settings
Besides the common settings, this field has the following specific settings:
Name | Description |
---|---|
size |
size of the input box. Optional. Default 10. |
inline |
Whether to display the date picker inline with the edit, e.g. do not require to click the input field to trigger the date picker? true or false (default). |
js_options |
Time picker options. See here. |
Sample code
array(
'name' => 'Time picker',
'id' => 'field_id',
'type' => 'time',
// Time options, see here http://trentrichardson.com/examples/timepicker/
'js_options' => array(
'stepMinute' => 15,
'controlType' => 'select',
'showButtonPanel' => false,
'oneLine' => true,
),
// Display inline?
'inline' => false,
),
Data
This field simply saves a single entered time in the database.
If the field is cloneable, then the value is stored as a serialized array in a single row in the database.
Template usage
To get the field value, use the following code:
$value = rwmb_meta( $field_id );
echo $value;
If field is cloneable:
$values = rwmb_meta( $field_id );
foreach ( $values as $value ) {
echo $value;
}
Read more about rwmb_meta().