Viewing 0 reply threads
  • Author
    Posts
    • #8369
      devx
      Participant

      I am trying to create a group in a metabox that has two groups underneath it.
      I’m doing this because I’d like all the data to be in one metabox (as opposed to splitting it into multiple metaboxes), and I’d like a single title on the left (“Roster”) and the two groups on the right (“Players” and “Goalies”) which are add-more groups, but i’m nesting them to get a title for each group.

      When I add in the second nested group, it does not render correctly (and does not seem to behave correctly). The title from the second group ends up as part of the first groups add-more content.

      Here is the file/code I have in the parts/metabox folder:

      <?php
      /*
      Title: Home Team Scoresheet
      Post Type: my_game
      Order: 30
      Collapse: false
       */
      
      piklist( 'field',
           array(
              'type' => 'group'
              ,'label' => 'Roster'
              ,'fields' =>
                  array(
                      array(
      					'type' => 'group'
      					,'label' => 'Players'
      					,'fields' =>
      						array(
      							array(
      								'type' => 'group'
      								//,'field' => 'player_roster'
      								,'add_more' => true
      								,'fields' =>
      									array(
      										array(
      											'type' => 'text'
      											,'field' => 'jersey'
      											,'label' => '#'
      											,'columns' => 2
      											,'attributes' => array(
      												'class' => 'text'
      											)
      										)
      										,array(
      											'type' => 'text'
      											,'field' => 'name'
      											,'label' => 'Name'
      											,'columns' => 4
      											,'attributes' => array(
      												'class' => 'text'
      											)
      										)
      
      									)
      							)
      						)
                      )
                      ,array(
      					'type' => 'group'
      					,'label' => 'Goalies'
      					,'fields' =>
      						array(
      							array(
      								'type' => 'group'
      								//,'field' => 'goalie_roster'
      								,'add_more' => true
      								,'fields' =>
      									array(
      										array(
      											'type' => 'text'
      											,'field' => 'jersey'
      											,'label' => '#'
      											,'columns' => 2
      											,'attributes' => array(
      												'class' => 'text'
      											)
      										)
      										,array(
      											'type' => 'text'
      											,'field' => 'name'
      											,'label' => 'Name'
      											,'columns' => 4
      											,'attributes' => array(
      												'class' => 'text'
      											)
      										)
      									)
      							)
      						)
                      )
      
                  )
           )
      );

      I’ll admit, I’m quite the novice, so any advice or direction is welcome! Thanks in advance!

Viewing 0 reply threads
  • You must be logged in to reply to this topic.