Home › Forums › Add-ons › Repeater Field › Repeater Field Bug: Looping First Field
Hello there, hope everyone is well
I’ll get straight to the point on this one. I’ve had a look all over the internet for a solution but no results or posts even closely relating.
The problem is that i’ve created a repeater field to contain two simple fields, one is the title for the content ‘tip_title’(text field) and the other is the content associated ‘tip_content‘(text area) as shown below:-
<div id="archiveTipBox">
<?php if(get_field('archive_tips')): ?>
<?php while(has_sub_field('archive_tips')): ?>
<div id="archiveTipsBoxContent">
<div class="tipTitle"><?php echo the_sub_field('tip_title');?></div>
<div class="tipContent">
<?php echo the_sub_field('tip_content');?>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
It has no problem repeating tip_title for each entry but for tip_content it just shows the first one in every single entry which makes no sense
Any help on this would be greatly appreciated as i’m completely lost
I’ve also attached these images just to show you in more detail
Perhaps this might help you.
<div id="archiveTipBox">
<?php if( have_rows('archive_tips') ):
while ( have_rows('archive_tips') ) : the_row(); ?>
<div id="archiveTipsBoxContent">
<div class="tipTitle"><?php the_sub_field('tip_title'); ?></div>
<div class="tipContent">
<?php the_sub_field('tip_content'); ?>
</div>
</div>
<?php endwhile; ?>
<?php else :
endif; ?>
</div>
Hi The code provided by @gwundrig should work perfectly,
In your code you are missing the_row();
which enables the repeater to loop through all the rows in the repeater.
The topic ‘Repeater Field Bug: Looping First Field’ is closed to new replies.
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.