Home Forums Add-ons Repeater Field Repeater not working!!!


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 class="col-sm-12 col-md-6 col-lg-6">
                                        <!-- <div class="banner-left-box">
                                            <img src="" alt="Technical Services">
                                        </div> -->
                <?php endwhile;?>
    <?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.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.