I have created a views page which displays teasers.

Is there a way I can apply teaser node id as a class of the teaser's row. Currently I am getting these classes

views-row views-row-8 views-row-even and views-row views-row-9 views-row-odd views-row-last

enter image description here

  • 1
    Sure, just create a template file for row display of that view, and preprocess it. Views even tells you what the template file needs to be called under Advanced -> Theme – Clive Apr 16 '14 at 8:12
  • @clive Thanks, I have found this code in theme information you have referred. can you tell me how to get the node id in this <div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"'; } ?>> – Fahad Ur Rehman Apr 16 '14 at 8:26
  • Difficult to say...try printing get_defined_vars() in the template file, it should show you what you have to work with – Clive Apr 16 '14 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.