Home › Forums › Add-ons › Repeater Field › Nested Repeater to show only one result › Reply To: Nested Repeater to show only one result
Hi @GavinA1970
The simpleset way is to break the while loop after you render the image like so:
<?php while( has_sub_field('project_images') ): ?>
<?php $firstimage = wp_get_attachment_image_src(get_sub_field('project_image'), 'full'); ?>
<img src="<?php echo $firstimage[0]; ?>" alt="" style="display: none;" class="fp_preview" />
<?php break; ?>
<?php endwhile; ?>
That will break out of the nested loop and continue the previous loop.
Hope that helps.
Thanks
E
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.