Title: Need Help Finalizing This Code
Last modified: September 23, 2020

---

# Need Help Finalizing This Code

 *  Resolved [mpturner](https://wordpress.org/support/users/mpturner/)
 * (@mpturner)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/need-help-finalizing-this-code/)
 * Greetings – Without attempting to explain here exactly what we’re looking to 
   achieve here because it is quite unique and complicated given our company’s website
   situation, we need help getting over two final roadblocks.
 * 1. Thanks to [@polarracing](https://wordpress.org/support/users/polarracing/)
   and a few others, the code below works great for us EXCEPT the SECOND nested `-
   repeater` is not repeating. All of the data is loading correctly once, then it
   moves to generate the next HTML table and stops.
 * 2. Due to the way our variables are set up here, we need the first repeater’s
   ACF SELECT to output as values vs. labels. So, that’s how we have it set in the
   ACF fields UI. As column headers in the table, we need to display these as labels
   but `out=label` does not work (the column headers disappear when we try it) We
   can change the ACF output to Label but then our variables stop working. In ACF,
   this is a SELECT with manually added choices (e.g., value : label combos).
 * If anyone could look at this code for any obvious/glaring issues in the loop 
   or whatever, that would be great.
 * Thanks!
 *     ```
       [repeater product_table]
   
       [set colheads][/set]
       [set colheadscount]0[/set]
       [set loopcount]0[/set]
       [set fieldtofetch][/set]
   
       <h2>[field product_table_title]</h2>
   
       <table style="width:100%">
   
       <tr>
   
       [-repeater product_table_columns]
   
       <th>[field product_table_column]</th>
   
       [if var=colheadscount value=0]
       [set colheads][field product_table_column][/set]
       [else]
       [set colheads][get colheads], [field product_table_column][/set]
       [/if]
   
       [set colheadscount][calc][get colheadscount]+1[/calc][/set]
   
       [/-repeater]
   
       </tr>
   
       [-repeater product_table_products]
       [related product_table_product]
   
       <tr>
   
       [loop]
   
       [set loopcount][calc][get loopcount]+1[/calc][/set]
   
       [pass vars]
       [set fieldtofetch][format split="," part={LOOPCOUNT}][get colheads][/format]
       [/set]
       [/pass]
   
       [pass vars]
       <td>[field {FIELDTOFETCH}]</td>
       [/pass]
   
       [/loop]
   
       </tr>
   
       [/related]
       [/-repeater]
   
       </table>
   
       [/repeater]
       ```
   
    -  This topic was modified 5 years, 8 months ago by [mpturner](https://wordpress.org/support/users/mpturner/).
    -  This topic was modified 5 years, 8 months ago by [mpturner](https://wordpress.org/support/users/mpturner/).
    -  This topic was modified 5 years, 8 months ago by [mpturner](https://wordpress.org/support/users/mpturner/).

Viewing 1 replies (of 1 total)

 *  Thread Starter [mpturner](https://wordpress.org/support/users/mpturner/)
 * (@mpturner)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/need-help-finalizing-this-code/#post-13445650)
 * Once again, I dunno how to delete a post but we solved this issue that probably
   no other person will ever encounter by resetting our loopcounter variable again
   just after the loop itself.
 * Carry on 🙂
 *     ```
       [repeater product_table]
   
       [set colheads][/set]
       [set colheadscount]0[/set]
       [set loopcount]0[/set]
       [set fieldtofetch][/set]
   
       <h2>[field product_table_title]</h2>
   
       <table style="width:100%">
   
       <tr>
   
       [-repeater product_table_columns]
   
       <th>[field product_table_column]</th>
   
       [if var=colheadscount value=0]
       [set colheads][field product_table_column][/set]
       [else]
       [set colheads][get colheads], [field product_table_column][/set]
       [/if]
   
       [set colheadscount][calc][get colheadscount]+1[/calc][/set]
   
       [/-repeater]
   
       </tr>
   
       [-repeater product_table_products]
       [related product_table_product]
   
       <tr>
   
       [loop]
   
       [set loopcount][calc][get loopcount]+1[/calc][/set]
   
       [pass vars]
       [set fieldtofetch][format split="," part={LOOPCOUNT}][get colheads][/format]
       [/set]
       [/pass]
       [pass vars]
       <td>[field {FIELDTOFETCH}]</td>
       [/pass]
   
       [/loop]
   
       [set loopcount]0[/set]
   
       </tr>
   
       [/related]
       [/-repeater]
   
       </table>
   
       [/repeater]
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Need Help Finalizing This Code’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [mpturner](https://wordpress.org/support/users/mpturner/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/need-help-finalizing-this-code/#post-13445650)
 * Status: resolved