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

Spacing Field


idstring A unique ID. This ID will be used to get the value
typestringspacingType of 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) 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
top_iconstringtop-iconThe icon/text to display on the border top field
right_iconstringright-iconThe icon/text to display on the border right field
bottom_iconstringbottom-iconThe icon/text to display on the border bottom field
left_iconstringleft-iconThe icon/text to display on the border left field
all_iconstringall-iconThe icon/text to display on the border all corners field
topbooltrueFlag to display top of the field
rightbooltrueFlag to display right of the field
bottombooltrueFlag to display bottom of the field
leftbooltrueFlag to display left of the field
allboolfalseFlag to display all corners of the field
show_unitsbooltrueFlag to display unit selector of the field
unitsarray The CSS measurement units (px em % cm pt)
outputarray|string CSS elements selector
output_modestringpaddingOutput CSS property of an element (relative padding margin)
output_importantboolfalseFlag to add !important rule on output css

Default Arguments

topnumberNumeric representing the default top field value
leftnumberNumeric representing the default left field value
bottomnumberNumeric representing the default bottom field value
rightnumberNumeric representing the default right field value
allnumberNumeric representing the default all field value
unitstringString representing the default unit value (px em %)

Simple Spacing Field Example

  'id' => 'example-spacing',
  'type' => 'spacing',
  'title' => 'Example Spacing',

Spacing Field Example with Defaults

  'id' => 'example-spacing',
  'type' => 'spacing',
  'title' => 'Example Spacing',
  'default' => array(
    'top' => '50',
    'right' => '100',
    'bottom' => '50',
    'left' => '100',
    'unit' => 'px',

Spacing Field Example with Specifics

  'id' => 'example-spacing',
  'type' => 'spacing',
  'title' => 'Example Spacing',
  'left' => false,
  'right' => false,
  'units' => array('px'),

Spacing Field Example with Output

  'id' => 'example-spacing',
  'type' => 'spacing',
  'title' => 'Example Spacing',
  'output' => '.heading-area',
  'output_mode' => 'padding',
  'default' => array(
    'top' => '10',
    'right' => '20',
    'bottom' => '10',
    'left' => '20',
    'unit' => 'px',
Was this article helpful to you? Yes No

How can we help?