2

Normally when I theme a field, I use a template suggestion in format field--fieldname--contenttype. However, it doesn't seem to be possible to do this with the node title. I've tried both of the following template suggestions:

field--title--contenttype.tpl.php
field--field-title--contenttype.tpl.php

Neither of them work (I've cleared caches). The title isn't technically a field, since it's more like a property on the node object, so that may be the problem?

Is there any way to theme the title field? It feels like I'm missing something simple.

N.b. I'm using panels and have dropped the node title pane into the panel but need to theme it differently.

3

You could use the Title module to convert your title to a proper field. Following that, your template file should work.

  • Very cool, I will check it out. – littledynamo Mar 21 '16 at 7:58
  • That worked perfectly, thanks! After converting the title to a field via the manage fields page on the content type, I was able to template the field using field--title-field--mycontenttype.tpl.php – littledynamo Mar 21 '16 at 10:02
  • Great to hear, Title is an epic module! – Stefanos Petrakis Mar 21 '16 at 14:21
0

Why not just edit the css file? #content h1 { color: blue; } Something like this. Node title is wrapped in content div and it is or You may check your page.tpl.php

  • I need to change the HTML structure as oppose to just the colour – littledynamo Mar 21 '16 at 7:53

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.