Support

Account

Home Forums Front-end Issues ACF Repeater Image

Helping

ACF Repeater Image

  • I’ve got a repeater with several fields (ACF PRO v5.8.11 / WordPress v5.4.1 multisite mode). One of these fields is an image field. When trying to echo the image field data I always get the data of the last image, all other image field data gets overwritten somehow.

    Here’s my code:

    <?php
    
        if( have_rows('kacheln') ):
    
            while ( have_rows('kacheln') ) : the_row(); ?>
    
                <div class="tile">
    
                <?php
                    
                    $image = get_sub_field('bild');
                    if( !empty( $image ) ){
                        echo wp_get_attachment_image( $image, $groesse );
                    }
                   
                ?>
    
                </div>
    
            <?php endwhile; 
            
        endif;
    
    ?>

    Also the get_fields function leads to the same conclusion:
    array(1) { ["kacheln"]=> array(2) { [0]=> array(6) { ["titel"]=> string(1) "A" ["externer_verweis"]=> string(2) "ja" ["link"]=> string(0) "" ["bild"]=> string(2) "32" ["seite"]=> string(0) "" ["kachelgroesse"]=> string(7) "einfach" } [1]=> array(6) { ["titel"]=> string(8) "About me" ["externer_verweis"]=> string(4) "nein" ["link"]=> string(0) "" ["bild"]=> string(2) "32" ["seite"]=> string(40) "https://antique-dollhouses.com/about-me/" ["kachelgroesse"]=> string(7) "einfach" } } }

    I read a about a similar problem a few months ago, but I couldn’t find the thread anymore.

  • What happens if you do the_sub_field('bild')? Does it return the same value everytime?

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

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.