Skip to content

Instantly share code, notes, and snippets.

@Godisgoodtoyou
Last active July 5, 2016 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Godisgoodtoyou/bcd02ad82056b8a61321e0a2e3d807d1 to your computer and use it in GitHub Desktop.
Save Godisgoodtoyou/bcd02ad82056b8a61321e0a2e3d807d1 to your computer and use it in GitHub Desktop.
$group_field_id = $box->add_field( array(
'id' => $prefix . 'group',
'type' => 'group',
'options' => array(
'group_title' => ($box->title) ? $box->title : __( 'Snippet {#}', 'cmb2' ), // {#} gets replaced by row number
'add_button' => __( 'Add Another Snippet', 'cmb2' ),
'remove_button' => __( 'Remove Snippet', 'cmb2' ),
// 'closed' => true,
),
) );
$box->add_group_field( $group_field_id, array(
'name' => __( 'Title', 'cmb2' ),
'id' => 'title',
'type' => 'text',
) );
$box->add_group_field( $group_field_id, array(
'name' => __( 'Code', 'cmb2' ),
'description' => __( 'Enter the code for the snippet', 'cmb2' ),
'id' => 'code',
'type' => 'textarea_code',
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment