Support

Account

Home Forums Bug Reports Image in repeater issue

Solving

Image in repeater issue

  • Hallo,

    When I create a repeater field with an image inside I can’t get the array output. It always outputs an ID or random int? When I configure the image to output as url it does work. I’m using ACF Pro V.5.8.9 en WordPress V.5.3.2.

    Also when I duplicate this repeater with an image inside, configured to output an URL. The duplicate repeater field is ok, but the field I duplicated loses the images output.

    Eg.

    Repeater field 1
    – Image | Ouput = URL
    – Other fields

    (Then I duplicate Repeater field 1) ->

    Repeater field 1
    – Image | Output = “” (No radio selected)
    – Other fields

    Repeater field 1 copy
    – Image | Output = URL
    – Other fields

  • Please show your code outputting these fields in your PHP.

  • 	if (have_rows("sidebar_bovenste_banners", $page_id)) {
    ?>
    	<ul id="side-bar-top" class="banners-slider">
    		<?php
    			while (have_rows("sidebar_bovenste_banners", $page_id)) { the_row();
    				$image = get_sub_field("banner");
    				$link = get_sub_field("link");
    		?>
    				<li>
    					<a href="<?php echo $link ?>" target="_blank">
    						<img src="<?php echo $image; ?>" alt="">
    					</a>
    				</li>
    		<?php
    			}
    		?>
    	</ul>
    <?php } ?>

    This would be the working solution, outputing the image URL instead of the array. Otherwhise I’d echo the image as $image[‘sizes’][‘somesize’] or print_r($image) to see the array. But it will return some random int.

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

The topic ‘Image in repeater issue’ is closed to new replies.