php - Limiting Results from an Array of values -


I am using advanced custom fields in Wordpress. Without knowing how it works, I have a "Reaper Field" which allows users to add multiple images to an array of backwards, because they please show these images, I have the following code (wordpress In the loop)

  & lt ;? Php if (get_field ('slider_images')):? & Gt; & Lt ;? Php while (the_repeater_field ('slider_images')) :? & Gt; & Lt ;? Php $ attachment_id = get_sub_field ('work_slider_image'); $ Size = "homepage"; $ Image = wp_get_attachment_image_src ($ attachment_id, $ size); Echo $ image [0]; ? & Gt; & Lt ;? Php timeline; end if; ? & Gt;   

Here the goal image is to create an array of URLS and display only one. All of them will be used on other pages, but on this page, I only want to capture the first image, so the resonance $ image [0];

For some reason, this is showing all uploaded images, and when I print the convertible $ image, this returns:

  Array ([0] = & gt; http://sitename.com/agsinfo/wp-content/upload/2/2012/07/1.jpg [1] => 392 [2] = & gt; 165 [3] = & gt;)   

After seeing this, it will be understandable that $ echo $ image [0]; will work, but not for any reason. any idea?

  & lt ;? Php if (get_field ('slider_images')):? & Gt; & Lt ;? Php while (the_repeater_field ('slider_images')) :? & Gt; & Lt ;? Php $ attachment_id = get_sub_field ('work_slider_image'); $ Size = "homepage"; $ Image [] = wp_get_attachment_image_src ($ attachment_id, $ size); ? & Gt; & Lt ;? Php timeline; Echo $ image [0]; end if; ? & Gt;    

Comments