Skip to content

Instantly share code, notes, and snippets.

@rahularyan
Last active October 26, 2017 03:44
Show Gist options
  • Save rahularyan/a0a910a87995c73dc2f065492a8d5545 to your computer and use it in GitHub Desktop.
Save rahularyan/a0a910a87995c73dc2f065492a8d5545 to your computer and use it in GitHub Desktop.
<?php
// AnsPress group field.
array(
...
'type' => 'group',
'toggleable' => true, // Checkbox for showing and hiding group.
'fields' => array(
'child-1' => array(
'label' => __( 'A simple child text field' ),
'type' => 'input',
),
'child-2' => array(
'label' => __( 'A simple child textarea field' ),
'type' => 'textarea',
),
'child-3' => array(
'label' => __( 'A simple child upload field' ),
'type' => 'upload',
),
// A group field can have group field as child.
'child-group' => array(
'label' => __( 'Group of field' ),
'type' => 'group',
'fields' => array(
'child-of-child-1' => array(
'label' => __( 'A simple child email field' ),
'type' => 'input',
'subtype' => 'email',
),
'child-of-child-2' => array(
'label' => __( 'A simple child password field' ),
'type' => 'input',
'subtype' => 'password',
),
),
),
),
...
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment