Dynamic Content for Custom Post Taxonomy

Hi there,

I am creating a template file to display information from a series of custom posts in 1 category. This type of posts has 3 different taxonomies attached to it, each with multi-selection answers, meaning it’s possible for each taxonomy to have 2+ values attached to it.

I can see as per this support topic that it’s possible to output these using a Looper.

The problem is this outputs the taxonomy values with no spaces inbetween and if I put commas into the looper it ends up looking badly formatted.

Two examples to illustrate:

  1. An example of this would be a taxonomy field on 1 post with 3 values included: Ash, Bubinga, and Douglas Fir

If I use a Looper to display this and use {{dc:term:title}} with a comma afterwards, it will output “Ash, Bubinga, and Douglas Fir,” (which has an unnecessary comma after fir)

  1. If I use that same Looper on a post with only 1 value included, Ash, then it would output “Ash,” (another unnecessary comma)

Is there any cleaner way to do this with a Looper or an alternative like using a dynamic content tag to grab the post’s taxonomy value then including a delimiter=", " to that dynamic content tag?

Thanks for any light you can shed on this.

Hi @BodhiJames,

You can achieve that by adding condition {{dc:looper:index}} and {{dc:looper:count}}. I have tried the same in my local environment and found it is working. Please find the video in the secure note, which explains the process.

Hope it helps.
Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.