Title: Loop inside loop
Last modified: August 30, 2016

---

# Loop inside loop

 *  Resolved [stevehtz](https://wordpress.org/support/users/stevehtz/)
 * (@stevehtz)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/loop-inside-loop-2/)
 * I have the same queston as [https://wordpress.org/support/topic/loop-inside-loop?replies=2](https://wordpress.org/support/topic/loop-inside-loop?replies=2),
   but the link posted by the plugin author to his answer at [https://uproot.us/forums/questions/1686/loop-within-a-loop](https://uproot.us/forums/questions/1686/loop-within-a-loop)
   is broken. Does anyone know the how to perform a loop inside a loop correctly?
 * Thanks in advance
 * [https://wordpress.org/plugins/custom-field-suite/](https://wordpress.org/plugins/custom-field-suite/)

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

 *  [Srikanth Kamath](https://wordpress.org/support/users/tskamath/)
 * (@tskamath)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/loop-inside-loop-2/#post-6336560)
 * Hi, things keeps changing a google search on “loop-within-a-loop” + “CFS” get
   you to [http://customfieldsuite.com/forums/questions/925/loop-within-a-loop](http://customfieldsuite.com/forums/questions/925/loop-within-a-loop)
 *  [Srikanth Kamath](https://wordpress.org/support/users/tskamath/)
 * (@tskamath)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/loop-inside-loop-2/#post-6336561)
 * When you use get() on a parent field (faq_section), all sub-field values (section_title,
   questions) are automatically retrieved and stored in the variable.
 *     ```
       <?php
       // Display everything within the "faq_section" loop
       $fields = $cfs->get('faq_section');
       foreach ($fields as $field) {
           echo '<h4>' . $field['section_title'] . '</h4>';
           foreach ($field['questions'] as $question) {
               echo '<h2>' . $question['question_title'] . '</h2>';
               echo '<div>' . $question['question_answer'] . '</div>';
           }
       }
   
       // Display the footer
       echo $cfs->get('footer_section');
       ?>
       ```
   
 *  Thread Starter [stevehtz](https://wordpress.org/support/users/stevehtz/)
 * (@stevehtz)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/loop-inside-loop-2/#post-6336582)
 * Thank you, [@tskamath](https://wordpress.org/support/users/tskamath/)! That was
   exactly what I needed.
 *  Thread Starter [stevehtz](https://wordpress.org/support/users/stevehtz/)
 * (@stevehtz)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/loop-inside-loop-2/#post-6336583)
 * topic resolved

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

The topic ‘Loop inside loop’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-field-suite.svg)
 * [Custom Field Suite](https://wordpress.org/plugins/custom-field-suite/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-field-suite/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-field-suite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-field-suite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-field-suite/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [stevehtz](https://wordpress.org/support/users/stevehtz/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/loop-inside-loop-2/#post-6336583)
 * Status: resolved