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

Image Select Field

Arguments

NameTypeDefaultDescription
idstring A unique ID. This ID will be used to get the value
typestringimage_selectType of the field
titlestring Title of the field
defaultarray|string 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 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   
optionsarray An array of object containing key/value pairs representing the options
multipleboolfalseFlag to allow multiple options choose
outputarray|string CSS elements selector
output_importantboolfalseFlag to add !important rule on output css

Simple Image Select Field Example

array(
  'id' => 'example-image-select',
  'type' => 'image_select',
  'title' => 'Image Select Example',
  'options' => array(
    'val1' => 'https://example.com/image1.png',
    'val2' => 'https://example.com/image2.png',
    'val3' => 'https://example.com/image3.png',
  ),
  'default' => 'val2',
),

Image Select Field Example with multiple choices

array(
  'id' => 'example-image-select',
  'type' => 'image_select',
  'title' => 'Image Select Example',
  'multiple' => true,
  'options' => array(
    'val1' => 'https://example.com/image1.png',
    'val2' => 'https://example.com/image2.png',
    'val3' => 'https://example.com/image3.png',
  ),
  'default' => array('val2','val3'),
),
Was this article helpful to you? Yes No

How can we help?