Title: Conditional Formatting Question
Last modified: August 22, 2016

---

# Conditional Formatting Question

 *  Resolved [KellyBalthrop](https://wordpress.org/support/users/kellybalthrop/)
 * (@kellybalthrop)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/conditional-formatting-question-1/)
 * I love this plug in. I am trying to display the content of taxonomy fields as
   a list of items separated by commas. I have a [loop] to display each post of 
   a custom type, then a [for each] to iterate through each taxonomy field like 
   so:
 *     ```
       [loop type="art_submission"]
       Title: [field title]
       Description: [field description]
       Worktype:[for each="worktype"] [each name],[/for]
       Gallery: [content gallery="native"]
       [/loop]
       ```
   
 * The problem with code is that I always get a trailing comma after the last item
   in the taxonomy list “worktype”:
 * Title: New Submission #3
    Description: This is a description area Worktype: Photography,
 * I tried some code for a conditional like this:
    `Worktype:[for each="worktype"][
   if last] [each name][else] [each name],[/if][/for]`
 * However the `[if last]` only refers to the **outer **loop, not the **each **loop.
   Is there a way to accomplish what I want out of the box or am I going to have
   to dig into some PHP for the template?
 * [https://wordpress.org/plugins/custom-content-shortcode/](https://wordpress.org/plugins/custom-content-shortcode/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/conditional-formatting-question-1/#post-5252205)
 * Hello,
 * I’ve run into this issue before, when trying to create a comma-separated list.
   In the latest update, I added a new parameter to both **[loop]** and **[for]**
   shortcodes, so you can set _trim=”true”_ to remove extra space or comma at the
   end.
 * Then I realized, there’s already a command to display a list of taxonomy terms
   for the post: `[taxonomy worktype]`

Viewing 1 replies (of 1 total)

The topic ‘Conditional Formatting Question’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/conditional-formatting-question-1/#post-5252205)
 * Status: resolved