Home Forums Add-ons Repeater Field Repeater not display in front end Reply To: Repeater not display in front end

  • Hey Jon,

    All seems fine. I did notice you’re using the ID return method for your image. The setting defaults to an array return so I’ve modified my answer to suit.

    I’ve tidied up your code and tested both in and out of the loop within a page template and it works perfectly.

    <div class="stats allignfull">
        <div class="wp-block-columns has-6-columns">
            <?php if( have_rows('stat_repeater') ): ?>
                <?php while( have_rows('stat_repeater') ): the_row(); ?>
                    <div class="wp-block-column">
                        <div class="wp-block-classic align">
                            $image = get_sub_field('stat_image');
                            if( $image ) {
                                $url = $image['url']; ?>
                                <p><img src="<?php echo esc_url($url); ?>" alt="<?php the_sub_field('stat_headline'); ?>" /></p>
                            <?php } ?>
                            <p class="headline">
                                <span class="font-color-blue-dark"><strong><?php the_sub_field('stat_headline'); ?></strong></span>
                            <p class="center-text"><?php the_sub_field('stat_text'); ?></p>
                <?php endwhile; ?>
            <?php endif; ?>

    The only reason I could see this not working is if you’re trying to get data from a different page. If this is the case you’d need to include the ID that is the source of the data in the initial query so, it’d be something like this:

    $page = get_page_by_title( 'About' );
    $about_page_id = $page->ID;
    <?php if( have_rows('stat_repeater', $about_page_id) ): ?>
        <?php while( have_rows('stat_repeater', $about_page_id) ): the_row(); ?>

    I hope this helps!