• Resolved bwdgroup

    (@bwdgroup)


    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

    (@bwdgroup)

    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.