Field types

Here is a list of the core fields available in Beans and the required field arguments which must be used when registering them.

Refer to using fields documentation to learn more about how to register and retrieve fields values.

Field type Description
Text Single text input
Textarea Simple textarea input
Select Simple select input
Checkbox Simple checkbox input
Radio Simple text or image based radio list
Image Single or multiple (gallery) images
Slider Value slider
Group A group of fields

Text

Output a text input.

array(
 'id' => 'field_id',
 'label' => 'Field label',
 'description' => 'Field description',
 'type' => 'text',
 'default' => ''
),

Textarea

Output a textarea input.

array(
  'id' => 'field_id',
 'label' => 'Field label',
 'description' => 'Field description',
 'type' => 'textarea',
 'default' => ''
),

Select

Output a select input.

array(
  'id' => 'field_id',
 'label' => 'Field label',
 'description' => 'Field description',
 'type' => 'select',
 'default' => 'value_1',
 'options' => array(
   'value_1' => 'Option Label 1',
    'value_2' => 'Option Label 2'
 )
),

Checkbox

Output a checkbox input.

array(
  'id' => 'field_id',
 'label' => 'Field label',
 'description' => 'Field description',
 'type' => 'checkbox',
 'default' => bool
),

Radio

Output a radio input. The radio field type can also be used to create an image based radio list. Simply add the path the individual images, where you would normally add the radio label.

array(
 'id' => 'field_id',
 'label' => 'Field label',
 'description' => 'Field description',
 'type' => 'radio',
  'default' => 'value_1',
 'options' => array(
   'value_1' => 'Radio Label',
   'value_2' => 'path/to/image.png' // Will replace the radio with the image set.
  )
),

Image

Single or multiple images. The image field can also be used for galleries by passing the multiple argument to true.

array(
 'id' => 'field_id',
 'label' => 'Field label',
 'description' => 'Field description',
 'type' => 'image',
  // 'multiple' => bool
),

Note: the image field type is not available in the customizer. Use WP_Customize_Image_Control as the field type instead.

Slider

UI value slider.

array(
  'id' => 'field_id',
 'label' => 'Field label',
 'description' => 'Field description',
 'type' => 'slider',
 'default' => integer,
 'min' => integer, // Minimum value.
 'max' => integer, // Maximum value.
 'interval' => integer,
  'unit' => 'unit', // Unit text.
),

Group

A group of fields. The fields group can be saved as a group in the database by setting the db_group argument to true.

array(
 'id' => 'field_id',
 'label' => 'Field label',
 'description' => 'Field description',
 'type' => 'group',
  'db_group' => bool, // Whether the group value should be saved together as an array in the db or not.
 'fields' => array( // Array of fields as they would be registered individually.
   array(
      'id' => 'field_id',
     'label' => 'Field label',
     'type' => 'text',
     'default' => ''
   ),
    array(
      'id' => 'field_id',
     'label' => 'Field label',
     'type' => 'textarea',
     'default' => ''
   ),
    // ...
  )
),