Is it possible to use tokens such as [view_node] in css ? I want to display links only for a particular content type.

Thanks !

  • Please provide more details, what you wanted to achieve.
    – Yogesh
    Mar 1, 2016 at 6:01

1 Answer 1


Assuming your view uses Show: fields.

Add type as a field, check mark the hide from view box.

Click on your field, in REWRITE RESULTS, checkmark rewrite outlput of field

In there, put <div class="all-links [type]">[field_name]</div>

Then in CSS

.all-links { display: none; }
.all-links.article { display: block !important; }

Another solution, is to use Views Conditional

Views Conditional is a simple module that allows you to define conditionals (if xxx then yyy) with fields in views.

Then just do a simple condition if type is x, then [field_name]

  • I'm not sure how this is a solution for this question, ie if those "links" are about a column which you want to show without links for "other" content types. Your solution excludes the entire row from the views results, no? Jan 25, 2017 at 7:38
  • @Pierre.Vriens Merci, answer adjusted, I originally missed read the question.
    – No Sssweat
    Jan 25, 2017 at 9:03
  • 1
    "Adjusted"??? Replaced entirely you mean ... by an answer which IMO should do the job ... Sorry I couldn't resist to critique your prior version of your answer ... Jan 25, 2017 at 9:11
  • If you change the row style output (display or style settings in left top) there is also a classes field that accepts tokens. Here you can apply a class for the whole row and you do not have to create div's yourself. Jan 25, 2017 at 9:13
  • @Neograph734 true, but here you just want to apply the class to the link field, well.. unless the entire row is just the link, then your suggestion is a valid alternative.
    – No Sssweat
    Jan 25, 2017 at 9:16

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.