Title: Image Array foreach showing same image
Last modified: February 24, 2020

---

# Image Array foreach showing same image

 *  Resolved [bwdgroup](https://wordpress.org/support/users/bwdgroup/)
 * (@bwdgroup)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/image-array-foreach-showing-same-image/)
 * Hello, I’m using the get_post_meta method for displaying custom fields in my 
   PHP templates in this example its a single post.
 * In PODS I have created a field called vehicle-image which is set to allow multiple
   images of vehicles. In my example I have uploaded 3 images which when I use the
   below script it shows 3 images but its the same image repeated, its seems like
   the array is being ignored and just showing the same image repeated.
 * I’m quite new to this so any help would be great.
 *     ```
       <?php 
   
           $pods = pods ( get_post_type(), get_the_ID() );
   
           $gallery_images = get_post_meta( get_the_ID(), 'vehicle-image', true );
   
       	foreach ( $gallery_images as $image ) {
   
       	echo pods_image( $image, 'medium' );
   
       }
   
           ?>
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [bwdgroup](https://wordpress.org/support/users/bwdgroup/)
 * (@bwdgroup)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/image-array-foreach-showing-same-image/#post-12475667)
 * I have decided to use a different method. example
 *     ```
       $pod = pods('vehicles', get_the_ID() );
   
       	$gallery = get_post_meta( $post->ID, 'vehicle-image');
   
       	//echo pods_image( get_post_meta(get_the_ID(), 'vehicle-image', true) );
   
       	foreach ( $gallery as $attachment ) {
   
       		echo pods_image( $attachment, 'trip_thumb');
       	}
   
           ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Image Array foreach showing same image’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [bwdgroup](https://wordpress.org/support/users/bwdgroup/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/image-array-foreach-showing-same-image/#post-12475667)
 * Status: resolved