I'd like to add a custom attribute into the title element whenever a particular content type is displayed, whether as an individual node or through a view (specifically when displaying 'full content'). How do I do this?

I'm using Drupal 7.

  • What does "custom tag" mean?
    – Letharion
    Nov 19 '12 at 19:23
  • Sorry, I meant attribute. I've edited my question. Nov 19 '12 at 19:31
  • did you try field.tpl?
    – monymirza
    Nov 20 '12 at 5:10

You could modify the field.tpl like monymirza suggested. But you may want to use hook_preprocess_field(&$vars) and target the title element within the $vars array.

Use that function in your theme and you may view the content/structure of the $vars array with dsm($vars) from the devel module.

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.