I have a mutidimensional array called 'gallery' in Pods that only contains photographs. I only want to return the first image of the array in my WordPress page, however all of the pics in the array are being displayed. Here's the code I'm currently using:
<?php
foreach($vehiclepods->field('gallery', true) as $picture) { ?>
<img src="<?php echo $picture['guid'];?>" alt="image" /></a>
<?php } ?>
What am I doing wrong and how can I just get the first image in the array to show up?
Well your output for images is wrapped in a foreach. So your going to get every image if you only want the first one use
This way gallery is an array and you are getting the first image src in the array. with
[0][guid]