I am using advanced custom fields in Wordpress. Without going into the details of how it works, I have a "repeater field" which lets the users add as many images to an aera of the backend as they please. To show these images, I use the following code (inside wordpress loop)
<?php if(get_field('slider_images')): ?>
<?php while(the_repeater_field('slider_images')): ?>
<?php
$attachment_id = get_sub_field('work_slider_image');
$size = "homepage";
$image = wp_get_attachment_image_src( $attachment_id, $size );
echo $image[0];
?>
<?php endwhile; endif; ?>
The goal here is to create an array of image URLS and to only display the FIRST one. On other pages they will all be used, but on this page, I want to grab ONLY the first image, hence the echo $image[0];
For some reason, it is showing all of the uploaded images, and when I print the variable $image, it returns:
Array ( [0] => http://sitename.com/agsinfo/wp-content/uploads/2012/07/1.jpg [1] => 392 [2] => 165 [3] => )
After seeing this, it would make sense to me that echo $image[0];
would work, but for some reason its not. Any ideas?