Arguments
Name | Type | Default | Description |
---|
id | string | | A unique ID. This ID will be used to get the value |
type | string | repeater | 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 value |
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 | | | |
fields | array | | An associative array containing fields for the repeater |
max | number | 0 | Maximum number of items the user can add |
min | number | 0 | Minimum number of items the user can add |
button_title | string | plus-icon | Text 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