Group field not showing in metabox
- This topic has 2 replies, 2 voices, and was last updated 8 years, 11 months ago by
Biznet.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
May 18, 2016 at 2:52 PM #3116
Biznet
ParticipantHi,
I'm new to the premium plugins, and I tried that night to implement a group field using the doc, but it looks like it won't appear in admin.
Below is my code. The other fields of the metabox are showing, and after a few tests, it looks like the group field class is loaded, but the html method is never triggered.meta_boxes[] = array( 'id' => 'infos_supp_adherent', 'title' => "Informations sur l'Adhérent", 'post_types' => array( 'adherent' ), 'fields' => array( array( 'name' => "Nom", 'id' => $prefix . "adherent_nom", "type" => "text", "required" => true, "clone" => false ), array( 'name' => "Prénom", 'id' => $prefix . "adherent_prenom", "type" => "text", "required" => true, "clone" => false ), array( 'name' => "Date de Naissance", 'id' => $prefix . "adherent_naissance", "type" => "date", "required" => true, "clone" => false, "dateFormat" => "dd/mm/yy" ), ), array( 'name' => "Coordonnées", 'id' => $prefix . "adherent_coordonnees", 'type' => 'group', //'required' => true, 'clone' => true, 'fields' => array( array( 'name' => 'Information', 'id' => $prefix . "adherent_coordonnees_valeur", 'type' => 'text', 'required' => true, 'clonable' => false, ) ) ) );
May 19, 2016 at 8:18 AM #3125Anh Tran
KeymasterOh, there is a syntax error in your code. Here is the correct one:
$meta_boxes[] = array( 'id' => 'infos_supp_adherent', 'title' => "Informations sur l'Adhérent", 'post_types' => array( 'adherent' ), 'fields' => array( array( 'name' => "Nom", 'id' => $prefix . "adherent_nom", "type" => "text", "required" => true, "clone" => false, ), array( 'name' => "Prénom", 'id' => $prefix . "adherent_prenom", "type" => "text", "required" => true, "clone" => false, ), array( 'name' => "Date de Naissance", 'id' => $prefix . "adherent_naissance", "type" => "date", "required" => true, "clone" => false, "dateFormat" => "dd/mm/yy", ), // Error was here when you close the outter bracket array( 'name' => "Coordonnées", 'id' => $prefix . "adherent_coordonnees", 'type' => 'group', //'required' => true, 'clone' => true, 'fields' => array( array( 'name' => 'Information', 'id' => $prefix . "adherent_coordonnees_valeur", 'type' => 'text', 'required' => true, 'clonable' => false, ), ), ), ), );
May 19, 2016 at 2:09 PM #3128Biznet
ParticipantHi,
indeed, it now does work fine.
Thanks ! -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- The topic ‘Group field not showing in metabox’ is closed to new replies.