Title: Using glue within [apr_loop]
Last modified: April 18, 2019

---

# Using glue within [apr_loop]

 *  [webfliccy](https://wordpress.org/support/users/webfliccy/)
 * (@webfliccy)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/using-glue-within-apr_loop/)
 * So I am trying to loop through items and display comma separated each time excluding
   the last item in the list. Relevant portion of code is as below. Is there an 
   equivalent of [apr field=”” glue=””] that can be used inside a loop?
 *     ```
       [apr_populate field="Coach" relatedTo="Coaches"]
       [apr_loop]
       Coaches: [apr_loop1 field="Coach"]<a href="/coaches-list/{{Slug}}">{{Name}}, </a>[/apr_loop1]
       [/apr_loop]
       ```
   
    -  This topic was modified 7 years, 2 months ago by [webfliccy](https://wordpress.org/support/users/webfliccy/).
    -  This topic was modified 7 years, 2 months ago by [webfliccy](https://wordpress.org/support/users/webfliccy/).
    -  This topic was modified 7 years, 2 months ago by [webfliccy](https://wordpress.org/support/users/webfliccy/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Pat K](https://wordpress.org/support/users/blackcapdesign/)
 * (@blackcapdesign)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/using-glue-within-apr_loop/#post-11460877)
 * Good question! I haven’t found an Airpress method to achieve this, but it is 
   possible using a CSS3 pseudo-element. If you wrap {{Name}} in a set of inline
   tags (such as span, i or em) it’s possible to add the comma as a pseudo-element
   via CSS like so:
 *     ```
       div.comma-separated-list span:after {
       	content: ', ';
       }
       div.comma-separated-list i:last-of-type:after {
       	content: '';
       }
       ```
   
 * It would be awesome if there were a way to achieve this with Airpress (seems 
   simple enough) but this is a workaround which I’ve used successfully. Hope this
   helps…
    pk
 *  Thread Starter [webfliccy](https://wordpress.org/support/users/webfliccy/)
 * (@webfliccy)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/using-glue-within-apr_loop/#post-11469795)
 * Thanks Pat K for thinking outside the box. I come from a front-end coding background
   so I like the use of css.
 * A related question is – can you tell if an `[apr]` loop is empty? For example
   I would like headings for different sections but only to display these when the
   field is not empty.
 *  [Pat K](https://wordpress.org/support/users/blackcapdesign/)
 * (@blackcapdesign)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/using-glue-within-apr_loop/#post-11469936)
 * Another good question! I know exactly what you mean and have run into this myself.
   There is no Airpress method that I am aware of (I’m sure Chester will chime in
   if there is). So headings that are followed by empty fields are just that: headings
   followed by empty fields. I seem to remember trying to use a jQuery filter to
   address this (removing these headings dynamically) without success. If you find
   a method to do this, please post your solution!
    pk

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Using glue within [apr_loop]’ 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/)

 * 3 replies
 * 2 participants
 * Last reply from: [Pat K](https://wordpress.org/support/users/blackcapdesign/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/using-glue-within-apr_loop/#post-11469936)
 * Status: not resolved