Skip to content

Instantly share code, notes, and snippets.

@ulaulaman
Created March 1, 2018 23:20
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 ulaulaman/5facc808d12857c18b075eb8fedbc1c5 to your computer and use it in GitHub Desktop.
Save ulaulaman/5facc808d12857c18b075eb8fedbc1c5 to your computer and use it in GitHub Desktop.
Group field defined with cmb2
<?php
add_action( 'cmb2_init', 'cmb2_add_metabox_didattica' );
function cmb2_add_metabox_didattica() {
$prefix = '_eduinaf_';
$curriculum_scolastico = $cmb->add_field( array(
'name' => __( 'Curriculum scolastico', 'eduinaf' ),
'id' => $prefix . 'curriculum_scolastico',
'type' => 'group',
'desc' => __( 'Cliccare su "Add Group" per aggiungere un nuovo gruppo di campi', 'eduinaf' ),
'options' => array(
'group_title' => __( 'Livello, materia, argomento', 'eduinaf' ),
'add_button' => __( 'Aggiungi un\'altra materia', 'eduinaf' ),
'remove_button' => __( 'Rimuovi', 'eduinaf' ),
'sortable' => true
)
) );
$cmb->add_group_field( $curriculum_scolastico, array(
'name' => __( 'Livello scolastico', 'eduinaf' ),
'id' => $prefix . 'curriculum_scolastico_livello_scolastico',
'type' => 'text',
) );
$cmb->add_group_field( $curriculum_scolastico, array(
'name' => __( 'Materia', 'eduinaf' ),
'id' => $prefix . 'curriculum_scolastico_materia',
'type' => 'text',
) );
$cmb->add_group_field( $curriculum_scolastico, array(
'name' => __( 'Certificazione', 'eduinaf' ),
'id' => $prefix . 'curriculum_scolastico_certificazione',
'type' => 'text',
) );
$cmb->add_group_field( $curriculum_scolastico, array(
'name' => __( 'Argomento', 'eduinaf' ),
'id' => $prefix . 'curriculum_scolastico_argomento',
'type' => 'text',
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment