Home › Forums › Add-ons › Flexible Content Field › Loop with Counter for Flexible Content Field Sub Field Output › Reply To: Loop with Counter for Flexible Content Field Sub Field Output
Hi @Brian Larson
Thanks for the explanation, I see what you are trying to do. Perhaps this is what you are after:
<?php if(get_row_layout() == '3_column_layout'):
// vars
$max = 3;
?>
<div class="row">
<?php for( $i = 1; $i <= $max; $i++ ); ?>
<div class="small-12 large-4 columns">
<dl>
<dt><?php the_sub_field("cb_{$max}_col_{$i}_header"); ?></dt>
<dd><?php the_sub_field("cb_{$max}_col_{$i}_copy"); ?></dd>
<dd><?php the_sub_field("cb_{$max}_col_{$i}_link"); ?></dd>
</dl>
</div>
<?php endfor; ?>
</div>
<?php endif; ?>
Untested, but should work
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.