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

Dimensions Field


idstring A unique ID. This ID will be used to get the value
typestringdimensionsType 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 values
attributesarray Extra HTML attributes to append to the field
sanitizestring Callback function for sanitizing value
validatestring Callback function for validating value
width_iconstringwidth-iconThe icon/text to display on the width of the field
height_iconstringheight-iconThe icon/text to display on the height of the field
widthbooltrueFlag to display width of the field
heightbooltrueFlag to display height of the field
show_unitsbooltrueFlag to display unit selector of the field
unitsarray The CSS measurement units (px, em, %)
outputarray|string CSS elements selector
output_prefixstring The settings for max / min to output CSS properties of element (max-width max-height)
output_importantboolfalseFlag to add !important fule on output css

Default Arguments

widthnumberNumeric representing the default width value
heightnumberNumeric representing the default height value
unitstringString representing the default unit value (px, em, %)

Simple Dimensions Field Example

  'id' => 'test-dimensions',
  'type' => 'dimensions',
  'title' => 'Dimensions with width and height',

Dimensions Field Example with Defaults

  'id' => 'test-dimensions',
  'type' => 'dimensions',
  'title' => 'Dimensions with defaults',
  'default' => array(
    'width' => '100',
    'height' => '250',
    'unit' => 'px',

Dimensions Field Example with Outputs

  'id' => 'test-dimensions',
  'type' => 'dimensions',
  'title' => 'Dimensions',
  'output' => '.heading',
Was this article helpful to you? Yes No

How can we help?