Home › Forums › Front-end Issues › wrapping repeater field inside divs depending of select sub field › Reply To: wrapping repeater field inside divs depending of select sub field
I believe you can do it like this:
<div class="row row_tabs">
<?php if(get_field('reference', 64)): $i = 0;?>
<?php while(has_sub_field('reference', 64)):?>
<?php if(get_sub_field('categorie') == "finance"):?>
<?php if ($i % 4 == 0) { ?>
<div class="row row_tabs">
<?php } ?>
<div class="col-xs-3 text-center">
<div class="inside">
<?php $image = get_sub_field('logo'); ?>
<?php if($image):?>
<img data-src="<?php echo $image['sizes']['medium']; ?>" class="lazyload" />
<?php endif; ?>
</div>
</div>
<?php $i++; ?>
<?php if ($i % 4 == 0) { ?>
</div>
<?php } ?>
<?php endif; ?>
<?php endif; ?>
<?php endwhile; endif; ?>
</div>
Please learn more about PHP here: http://www.w3schools.com/php/.
I hope this helps.
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.