Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8205349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:12:16+00:00 2026-06-07T08:12:16+00:00

I am using advanced custom fields in WordPress. Without going into the details of

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:12:18+00:00Added an answer on June 7, 2026 at 8:12 am
        <?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 ); 
    
         ?>
    <?php endwhile;
     echo $image[0];
     endif;  ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using wordpress's advanced custom fields, which uses the syntax get_field('custom_field_name'); to pull
I am using the Advanced Custom Fields wordpress plugin and I am outputting the
I am using Dmxzones Advanced HTML Editor 3 which inserts the following code: <textarea
I'm using Filemaker Pro 12 Advanced. I have a few tables but have really
I'm trying to create a custom module using Magento's EAV structure and have been
I want to add some custom fields to add new user in Wordpress .
I have a custom content type with 3 FileFields (plone.app.blob.field.FileField) and I want to
Got problem with opening custom context menu using advanced user interactions API in Selenium
I have a form in which some of the fields need to be validated
I need to make some translations from/into the French/Dutch/German languages using Delphi 2006 (without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.