Support

Account

Home Forums Add-ons Gallery Field Show only one image from the gallery field

Solved

Show only one image from the gallery field

  • Hi, I’m trying to show only one image from my gallery field as a thumbnail and when the viewer clicks it a fancybox slideshow pops up.

    This is what I have so far:

    <?php 
    		$images = get_field('gallery'); 
    		$image_1 = $images[0]; 
    		?>    
    
    		<img src="<?php echo $image_1; ?>" />    

    But the HTML shows this…

    <img src="Array">

    Please advise.

  • I solved it by adding [url] after $image_1 in the img tag.

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

The topic ‘Show only one image from the gallery field’ is closed to new replies.