1. Home
  2. Docs
  3. WordPress Studio Framework
  4. Framework Fields
  5. Date Field

Date Field

Arguments

NameTypeDefaultDescription
idstring A unique ID. This ID will be used to get the value
typestringdateType of the field
titlestring Title of the field
defaultarray Default value from database, if option doesn’t exist
subtitlestring Subtitle to display below the title
descstring Description to display after the field
helpstring Extra CSS classes (space separated) to append to the field
beforestring Content to display before the field
afterstring Content to display after the field
dependencyarray Define field visibility depending on other field values
attributesarray Extra HTML attributes to append to the field
sanitizestring Callback function for sanitizing value
validatestring Callback funciton for validating value
EXTRAS   
settingsarray An associative array containing arguments for the setting

Settings Arguments

NameTypeDefaultDescription
dateFormatstringmm/dd/yyFormat for parsed and displayed dates
changeMonthboolfalseFlag to display month as dropdown instead of text
changeYearboolfalseFlag to display year as dropdown instead of text
showWeekboolfalseWhen true, a column is added to show the week of the year
showButtonPanelboolfalseFlag to display a button pane underneath the calendar
weekHeaderstringWkText to display for the week of the year column heading
monthNamesShortarray List of abbreviated month names, as used in the month header on each datepicker and as requested via the dateFormat option
dayNamesMinarray List of minimised day names, starting from Sunday, for use as column headers within the datepicker

Get more information for jquery-ui-datepicker arguments.

Simple Date Field Example

array(
  'id' => 'test-date',
  'type' => 'date',
  'title' => 'Example Date',
),

Advanced Date Field Example

array(
  'id' => 'test-date',
  'type' => 'date',
  'title' => 'Example Date',
  'settings' => array(
    'dateFormat' => 'mm/dd/yy',
    'changeMonth' => true,
    'changeYear' => true,
    'showWeek' => true,
    'showButtonPanel' => true,
    'weekHeader' => 'Week',
    'monthNamesShort' => array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ),
    'dayNamesMin' => array( 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ),
  ),
),
Was this article helpful to you? Yes No

How can we help?