Arguments
Name | Type | Default | Description |
---|
id | string | | A unique ID. This ID will be used to get the value |
type | string | dimensions | Type of the field |
title | string | | Title of the field |
default | array | | Default value from database, if the option doesn’t exist |
subtitle | string | | Subtitle to display below the title |
desc | string | | Description to display after the field |
help | string | | Text to display on right-corner (as hover/popup) of the field |
class | string | | Extra CSS classes (space separated) to append to the field |
before | string | | Content to display before the field |
after | string | | Content to display after the field |
dependency | array | | Define field visibility depending on other field values |
attributes | array | | Extra HTML attributes to append to the field |
sanitize | string | | Callback function for sanitizing value |
validate | string | | Callback function for validating value |
EXTRAS | | | |
width_icon | string | width-icon | The icon/text to display on the width of the field |
height_icon | string | height-icon | The icon/text to display on the height of the field |
width | bool | true | Flag to display width of the field |
height | bool | true | Flag to display height of the field |
show_units | bool | true | Flag to display unit selector of the field |
units | array | | The CSS measurement units (px, em, %) |
output | array|string | | CSS elements selector |
output_prefix | string | | The settings for max / min to output CSS properties of element (max-width max-height) |
output_important | bool | false | Flag to add !important fule on output css |
Default Arguments
Name | Type | Description |
---|
width | number | Numeric representing the default width value |
height | number | Numeric representing the default height value |
unit | string | String representing the default unit value (px, em, %) |
Simple Dimensions Field Example
array(
'id' => 'test-dimensions',
'type' => 'dimensions',
'title' => 'Dimensions with width and height',
),
Dimensions Field Example with Defaults
array(
'id' => 'test-dimensions',
'type' => 'dimensions',
'title' => 'Dimensions with defaults',
'default' => array(
'width' => '100',
'height' => '250',
'unit' => 'px',
),
),
Dimensions Field Example with Outputs
array(
'id' => 'test-dimensions',
'type' => 'dimensions',
'title' => 'Dimensions',
'output' => '.heading',
),
Was this article helpful to you?
Yes
No