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

Repeater Field

Arguments

NameTypeDefaultDescription
idstring A unique ID. This ID will be used to get the value
typestringrepeaterType 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 value
attributesarray Extra HTML attributes to append to the field
sanitizestring Callback function for sanitizing value
validatestring Callback function for validating value
EXTRAS   
fieldsarray An associative array containing fields for the repeater
maxnumber0Maximum number of items the user can add
minnumber0Minimum number of items the user can add
button_titlestringplus-iconText to display on the add button

Simple Repeater Field Example

array(
  'id' => 'example-repeater',
  'type' => 'repeater',
  'title' => 'Repeater',
  'fields' => array(
    array(
      'id' => 'example-text',
      'type' => 'text',
      'title' => 'Example Text',
    ),
  ),
),

Repeater Field Example with Defaults

array(
  'id' => 'example-repeater',
  'type' => 'repeater',
  'title' => 'Repeater',
  'fields' => array(
    array(
      'id' => 'example-text',
      'type' => 'text',
      'title' => 'Example Text',
    ),
    array(
      'id' => 'example-text-2',
      'type' => 'text',
      'title' => 'Example Text',
    ),
  ),
  'default' => array(
    array(
      'example-text' => 'Text One Default',
      'example-text-2' => 'Text Two Default',
    ),
    array(
      'example-text' => 'Text One Default Two',
      'example-text-2' => 'Text Two default Two',
    ),
  ),
),
Was this article helpful to you? Yes No

How can we help?