Title: loop through image problem
Last modified: April 14, 2017

---

# loop through image problem

 *  Resolved [mazoola](https://wordpress.org/support/users/mazoola/)
 * (@mazoola)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/loop-through-image-problem/)
 * Chet –
 * I’m having trouble getting [apr_loop] to step through a record’s image field 
   correctly. It seems to work OK when the record is being accessed through a loop
   of matching records, but not when an individual record is returned.
 * The first case, the one that works properly, is the one whose solution you provided
   a few tickets ago. With a virtual post matching on “FIND(‘$1’,genre) > 0” the
   following code returns a list of matching records. If the ‘images’ field isn’t
   empty, the line includes a thumbnail for each image. (Indented for readability.)
 *     ```
       [apr_loop]
           {{available}} 
           [apr_loop1 field="images"]
               <img src="{{thumbnails|small|url}}" /> 
           [/apr_loop1] 
           <a href="/wardrobe/garment/{{slug}}">{{Name}}</a><br />
       [/apr_loop]
       ```
   
 * Clicking on the linked garment Name triggers a second Virtual Post, this time
   matching “slug = ‘$1’.” (‘Slug’ is a sanitized, lowercase version of the primary‘
   Name’ field, concatenated with the record’s Auto Number.)
 * The post maps to a per-garment template. Unfortunately, the following code on
   that template returns only the thumbnail of the **first **attached image:
 *     ```
       [apr_loop field="images"]<img src="{{thumbnails|small|url}}">[/apr_loop]
       ```
   
 * Elsewhere on that page, I loop through a one-to-many linked record without any
   problem by populating the field and then looping through the related record, 
   so the looping mechanism works.
 * Caveat: I’m not doing this on a clean install, so there are potential conflicts
   with the theme and other plugins. I’m hoping that the image loop’s working fine
   in the first situation means that’s not the case, but I’ll test on a clean install
   if necessary.
 * Thanks!
    -  This topic was modified 9 years, 1 month ago by [mazoola](https://wordpress.org/support/users/mazoola/).
      Reason: fixing a typo causes a 72-hour moderation hold?

Viewing 1 replies (of 1 total)

 *  Plugin Author [Chester McLaughlin](https://wordpress.org/support/users/chetmac/)
 * (@chetmac)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/loop-through-image-problem/#post-9030914)
 * Great feedback! Thanks for the details. I reproduced the error and found/fixed
   it. Releasing v1.1.33 now.

Viewing 1 replies (of 1 total)

The topic ‘loop through image problem’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/airpress_c9d28c.svg)
 * [Airpress](https://wordpress.org/plugins/airpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/airpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/airpress/)
 * [Active Topics](https://wordpress.org/support/plugin/airpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/airpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/airpress/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Chester McLaughlin](https://wordpress.org/support/users/chetmac/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/loop-through-image-problem/#post-9030914)
 * Status: resolved