Home Forums General Issues Repeater field Image and Text not rendering in basic loop


Repeater field Image and Text not rendering in basic loop

  • I’ve used Repeater fields before but it’s not working properly. It’s just outputting empty divs.

    Here’s my code:

    <div class="masonry">
            // check if the repeater field has rows of data
            if( have_rows('card') ):
                // loop through the rows of data
                while ( have_rows('card') ) : the_row();
                    // display a sub field value
                   ?> <div class="brick">
                        <h1> test  <?php echo get_sub_field('card-title'); ?> </h1>
                        <img src="<?php echo get_sub_field('card-picture');?>">
                    </div> <?php
            else :
                // no rows found
        </div>  <!-- masonry -->

    And here’s what my fields look like:


  • You have - // dash in your get_sub_field calls and these are _ // underscore in your field names in ACF.

  • I am such an idiot. I’m sorry I even bothered yall with this basic of an issue. Ugh! I need to get better at checking my syntax.

  • Sometimes it just takes another set of eyes, don’t be sorry. Me being able to see that error so quickly should tell you that I’ve made the same mistake myself, and it was quite frustrating looking at code and not being able to figure out what was causing it. The human brain is a funny thing, a lot of times it sees what it expects to see rather than what’s really there.

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

The topic ‘Repeater field Image and Text not rendering in basic loop’ is closed to new replies.