I got a view listing nodes of the content type "Job". Every node is tagged with different "Jobtypes" that are listed too. Now I want to style every taxonomy different (colors, icons, etc.) so it would be nice, every taxonomy would have his own class. At the moment I don't see a way to do this. Some ideas? Thank you!

3 Answers 3

  1. Relationship: Choose "Content: Taxonomy terms on node" & "Jobtypes"
  2. Field: Add "term id"(Exclude from display) with relationship
  3. Field: Add Jobtypes Field and "Rewrite the output of this field" with token

such as:

<div class="jobtypes-[tid]">[field_jobtypes]</div>

will get each term with unique css class with its term id.


It seems the Field Formatter CSS Class module is what you're looking for.

Adds a formatter for text/list/taxonomy fields to render as CSS classes on nodes.

The Field formatter CSS class module allows you to set any text/list/option/taxonomy field to render as CSS class on the node. This enables the node author to select predefined CSS styling per node.

  • Views has this feature already (but it only applies to the <div> wrapper on a term reference field, not individual terms), that module's for fields on nodes, not in Views. Apr 22, 2016 at 11:34

In the view add the taxonomy as a field and exclude it from display. Install views_php module. This module adds a field to tje view such that it's value is a php code and it uses the values of the current row as well. You can simply check for the current value of the taxonomy in the php field of the view then for every value of the taxonomy term output the approprite icon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.