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

Number Field

Attributes

NameTypeDefaultDescription
idstring A unique ID. This ID will be used to get the value
typestringnumberType of the field
titlestring Title of the field
defaultarray Default value from database, if the option doesn’t exist
subtitlestring Subtitle to display below the title
descstring Description to display after the field
helpstring Text to display on right-corner (as hover/popup) of the field
classstring 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 value
attributesarray Extra HTML attributes to append to the field
sanitizestring Callback function for sanitizing value
validatestring Callback function for validating value
EXTRAS   
unitstringpxThe unit to display of the field, also sets output CSS property unit value
outputarray|string CSS elements selector
output_modestringwidthOutput CSS property of an element. for(  width  height  max-width )
output_importantboolfalseFlag to add !important rule on output css

Simple Number Field Example

array(
  'id' => 'example-number',
  'type' => 'number',
  'title' => 'Number Example',
),

Number Field Example with Default

array(
  'id' => 'example-number',
  'type' => 'number',
  'title' => 'Number Example',
  'default' => 50,
),

Number Field Example with Output

array(
  'id' => 'example-number',
  'type' => 'number',
  'title' => 'Number Example',
  'unit' => '%',
  'output' => '.header-area',
  'output_mode' => 'width',
  'default' => 100,
),

 

Was this article helpful to you? Yes No

How can we help?