I got a field with xyz as machine name, and I created a field--field-xyz.tpl.php template file, but it does not take any effect.
I used the template file to add views-field and views-field-field-xyz as CSS classes, but they don't show up.

What did I do wrong? Is it because I am using the Adaptive theme?

  • Have you tried clearing cache etc.? – Wtower Feb 21 '14 at 8:22
  • yes, i cleared it. – Sven Feb 21 '14 at 8:24
  • Where did you place the template file ? Is your base theme set correctly ? – AyeshK Feb 21 '14 at 10:03
  • @Wtower. The solution is, not just clearing the cache. You also have to flush theme caching. drupal.org/node/337176 How lovely it is .. spending hours for a solution like this. Great! Can't actually answer my own question.. – Sven Feb 21 '14 at 11:59
  • Sorry, can't get the difference... – Wtower Feb 21 '14 at 12:02

Does xyz field name contain underscores?

Note that underscores in a Field's machine name are replaced by hyphens. Also remember to include "field-" in custom field names, e.g: field--field-phone.tpl.php.


EDIT: Add a hook_preprocess_field(&$vars) in your theme and dpm($vars) to check up on theme_hook_suggestions array for this field.

  • Thx, but that is not the solution, i know the suggestions. i am really frustrated. this should be a piece of cake. – Sven Feb 21 '14 at 10:38

Your Answer

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

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