Viewing 1 reply thread
  • Author
    Posts
    • #9564
      Md Rashed Hossain
      Participant

      I used this code for the nested group with add_more, now how can I show the output. My code

      <?php
      
      /**
      * Title: Section
      * Post Type: doc
      **/
      
      piklist( 'field', array(
      	'type'		=> 'group',
      	'field'		=> 'tdoc_section',
      	'label'		=> __( 'Section', 'tdoc' ),
      	'add_more'	=> true,
      	'fields'	=> array(
      		array(
      			'type'			=> 'text',
      			'field'			=> 'title',
      			'label'			=> __( 'Section Title', 'tdoc' ),
      			'attributes' 	=> array(
      		      'class' 		=> 'widefat'
      		    )
      		),
      		array(
      			'type'		=> 'editor',
      			'field'		=> 'description',
      			'label'		=> __( 'Section Description', 'tdoc' ),
      			'template' 	=> 'field',
      			'options'	=> array(
      			    'wpautop' 				=> true,
      			    'media_buttons' 		=> true,
      			    'shortcode_buttons' 	=> true,
      			    'teeny' 				=> true,
      			    'dfw' 					=> true,
      			    'quicktags' 			=> true,
      			    'drag_drop_upload' 		=> true,
      			    'tinymce' 				=> array(
      			    	'resize' 			=> true,
      			    	'wp_autoresize_on' 	=> true
      			    )
      			)
      		),
      		array(
      			'type'		=> 'group',
      			'field'		=> 'tdoc_section_group',
      			'label'		=> __( 'Sub Section', 'tdoc' ),
      			'add_more'	=> true,
      			'fields'	=> array(
      				array(
      					'type'			=> 'text',
      					'field'			=> 'sub_title',
      					'label'			=> __( 'Section Title', 'tdoc' ),
      					'attributes' 	=> array(
      				      'class' 		=> 'widefat'
      				    )
      				),
      				array(
      					'type'		=> 'editor',
      					'field'		=> 'sub_description',
      					'label'		=> __( 'Section Description', 'tdoc' ),
      					'template' 	=> 'field',
      					'options'	=> array(
      					    'wpautop' 				=> true,
      					    'media_buttons' 		=> true,
      					    'shortcode_buttons' 	=> true,
      					    'teeny' 				=> true,
      					    'dfw' 					=> true,
      					    'quicktags' 			=> true,
      					    'drag_drop_upload' 		=> true,
      					    'tinymce' 				=> array(
      					    	'resize' 			=> true,
      					    	'wp_autoresize_on' 	=> true
      					    )
      					)
      				)
      			)
      		)
      	)
      ));
      
    • #10607
      Steve
      Keymaster

      Welcome to the Piklist community!

      By assigning a field to a group, the data is saved as an array to tdoc_section. So, to retrieve the data use:

      get_post_meta($post->ID, 'tdoc_section')

      You can then loop through the data.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.