Skip Navigation

[Resolved] Customize taxonomy list

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to display a list of terms associated with each post in the View.

Solution: Use a View of this Taxonomy and add a term filter, set by the current post in the loop.

This support ticket is created 5 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by romanB-3 5 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1226835

Hello,

I have a posts view where I want to display all terms for each taxonomy. For now it's something like

[wpv-post-taxonomy type="lieu"]

I would need the output to render the list of terms for a taxonomy, but with specific attributes for each term.
For instance :

<a href="#" class="taxonomy term-slug term-id" title="Term Name">Term Name</a>

I suppose I should use a custom shortcode in order to doing this, but I'd like to know what hook or function you would recommend to setup in order to do this ?

Thank you.

#1226894

Hi, you can actually do this with a taxonomy View and avoid extra custom code.
- Create a View, choose "show all results" in the popup, then select the Lieu taxonomy in Content Selection.
- Add a Query Filter by taxonomy term, where the term is set by the current post in the loop.
- In the Loop editor, build your link tag HTML using Views shortcodes to insert the term slug, term ID and term name as needed.
- Insert this View in your View of posts.

Let me know if you have questions about that.

#1227096

This worked great, thank you very much.
Would it be possible to add a separator between each term, except for the last.
For instance "lieu1, lieu2, lieu3" instead of actual "lieu1, lieu2, lieu3, " ?

#1227883

Yes, you can use Views "index" and "item" to add different separators depending on the item in the loop.
https://toolset.com/documentation/user-guides/digging-into-view-outputs/#vmeta-wpv-loop-parameters

#1227898

My issue is resolved now. Thank you!