Title: Using table within Group field type
Last modified: September 22, 2017

---

# Using table within Group field type

 *  Resolved [melindacooper](https://wordpress.org/support/users/melindacooper/)
 * (@melindacooper)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/using-table-within-group-field-type/)
 * I am trying to use Advanced Custom Fields: Table Field within a Group field type.
   To show other group items i am using this:
 *     ```
       // vars
       $zone_4 = get_field('zone_4');
   
       if( $zone_4 ): ?>
       <div id="zone_4" style="margin: 0 -9999rem; padding: 0.25rem 9999rem; background: url(<?php echo $zone_4['background_image']; ?>); background-repeat: no repeat; background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; height: 432px; overflow: hidden;">
       	<div style="text-align:center;"><img src="<?php echo $zone_4['image']; ?>" /></div>
       	<h1 style="text-align:center;"><?php echo $zone_4['header']; ?></h1>
       	<div><p><?php echo $zone_4['content']; ?></p></div>
       <div>
       ```
   
 * I now want to show the table and I am using:
 *     ```
       <?php
   
       $table = get_field( 'table' );
   
       if ( $table ) {
   
           echo '<table border="0">';
   
               if ( $table['header'] ) {
   
                   echo '<thead>';
   
                       echo '<tr>';
   
                           foreach ( $table['header'] as $th ) {
   
                               echo '<th>';
                                   echo $th['c'];
                               echo '</th>';
                           }
   
                       echo '</tr>';
   
                   echo '</thead>';
               }
   
               echo '<tbody>';
   
                   foreach ( $table['body'] as $tr ) {
   
                       echo '<tr>';
   
                           foreach ( $tr as $td ) {
   
                               echo '<td>';
                                   echo $td['c'];
                               echo '</td>';
                           }
   
                       echo '</tr>';
                   }
   
               echo '</tbody>';
   
           echo '</table>';
       }
   
       ?>
       ```
   
 * zone_4 is the group name and table is the sub-field name (where I am using your
   plugin)
    I get nothing on the page and no errors Any help on how to use this 
   within a Group field type would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/using-table-within-group-field-type/#post-9522343)
 * If ‘table’ is in your group field, you have to get the table like this…
 *     ```
       $zone_4 = get_field('zone_4');
       $table = $zone_4['table'];
       ```
   
 *  Thread Starter [melindacooper](https://wordpress.org/support/users/melindacooper/)
 * (@melindacooper)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/using-table-within-group-field-type/#post-9527748)
 * Thank you, that worked!!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Using table within Group field type’ is closed to new replies.

 * ![](https://ps.w.org/advanced-custom-fields-table-field/assets/icon-256x256.png?
   rev=1962986)
 * [Table Field Add-on for ACF and SCF](https://wordpress.org/plugins/advanced-custom-fields-table-field/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields-table-field/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [melindacooper](https://wordpress.org/support/users/melindacooper/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/using-table-within-group-field-type/#post-9527748)
 * Status: resolved