Home › Forums › Add-ons › Repeater Field › Question about conditional branch with Repeater Field › Reply To: Question about conditional branch with Repeater Field
Hi,elliot.
I couldn’t get result with what I posted.
But finally I could get good result with below code.
Thank you for your comment.
<?php
$gallery = get_field('gallery' ); // get all the rows
$gallery_items = $gallery[0]; // get the first row
$gallery_item = $gallery_items['gallery_photo']; // get the sub field value
if($gallery_item):
?>
<div class="box">
<h3><img src="images/images.png" /></h3>
<div id="gallery" class="ad-gallery">
<div class="ad-image-wrapper"></div>
<div class="ad-nav">
<div class="ad-thumbs">
<ul class="ad-thumb-list">
<?php while(has_sub_field('gallery')): ?>
<?php
$image = wp_get_attachment_image_src(get_sub_field('gallery_photo'), 'large');
$thumb = wp_get_attachment_image_src(get_sub_field('gallery_photo'), 'thumbnail');
?>
<li><a href="<?php echo $image[0] ?>"><img src="<?php echo $thumb[0] ?>"></a></li>
<?php endwhile; ?>
</ul>
</div>
</div>
</div>
</div>
<?php endif; ?>
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.