Home › Forums › Add-ons › Repeater Field › Repeater not working!!!
ACF repeater “if” is working but “while” not working. The code is mentioned below. We have a banner and it is a repeater the if field is working and enters inside the “tnc-banner” section, but after “banner__slider” class div the repeater is not working and all the sections and divs inside and after the section is not showing(blank) and working.
<?php if (have_rows('tnc_homepage_banner_slider')) : ?> <!-- Banner --> <section class="tnc-banner"> <div class="banner__slider"> <?php while (have_rows('tnc_homepage_banner_slider')) : the_row(); $image = get_sub_field('image'); ?> <div class="banner" style="background-image: url('<?php echo $image['url']; ?>');"> <div class="container-xxl"> <div class="banner-inner"> <div class="row"> <div class="col-sm-12 col-md-6 col-lg-6"> <div class="banner-left-box flex-column"> <?php the_sub_field('content'); ?> <a class="button" href="<?php the_sub_field('button_link'); ?>"><?php the_sub_field('button_name'); ?></a> </div> </div> <div class="col-sm-12 col-md-6 col-lg-6"> <!-- <div class="banner-left-box"> <img src="http://22.214.171.124/wp-content/uploads/2022/06/Main-Image-updated-min.png" alt="Technical Services"> </div> --> </div> </div> </div> </div> </div> <?php endwhile;?> </div> </section> <?php endif; ?>
What causing the issue? How to fix this? This code is belongs to the front-page.php in the theme directory.
We implemented the social icons using repeater filed using the same way and it is working fine. Here in homepage/frontpage it doesn’t work. All the sections after the banner section not showing.
We got the solution, and it was a return format mistake. The image field’s return format inside the repeater field was “Image URL,” and we changed it to “Image Array,” and the issue got fixed and the sections are working properly.
You must be logged in to reply to this topic.
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!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.