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

Radio Field

Arguments

NameTypeDefaultDescription
idstring A unique ID. This ID will be used to get the value
typestringradioType of field
titlestring Title of the field
defaultstring 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
EXTRAS   
empty_messagestring Display to empty text if options empty
optionsarray|string An array of object containing key/value pairs representing the options or use a predefined options ( pages posts categories tags menus users sidebars roles post_types)
query_argsarray An associative array of query arguments

Radio Field Example

array(
  'id' => 'example-radio',
  'type' => 'radio',
  'title' => 'Radio',
  'options' => array(
    'opt1' => 'Option One',
    'opt2' => 'Option Two',
    'opt3' => 'Option Three',
  ),
  'default' => 'opt2',
),
Was this article helpful to you? Yes No

How can we help?