Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Tried this multiple times with different content types. Can't get node-content-type.tpl.php to be recognized, though I cleared caches. Wondered if this is a sub-theme issue. But there is a node.tpl.php file sitting in the austin theme root. Any ideas?
Joseph
Comments
Comment #1
j0e CreditAttribution: j0e commentedI neglected to mention that I was able to override other template files, such as block.tpl.php; just isn't working with the node template.
Thanks,
Joseph
Comment #2
j0e CreditAttribution: j0e commentedStrange, this did happen once before, suddenly it's working for one custom content type yet still not the other. I checked the usual suspects, name of the content type etc. it's all correct... again, caches are all cleared so that's not it either. I would rather it's a problem with the content type than the theme, but I still can't figure out what's causing the lack of recognition of the node-content-type.tpl.php file.
Comment #3
caroltron CreditAttribution: caroltron commentedI tested adding a new content type of "event" and added a tpl called node-event.tpl.php and did not experience any issues. Is it possible that you removed the node.tpl.php? In D6 it is required that you have the node.tpl.php in addition to the node-contenttype.tpl.php. (I believe that this has change, however, in D7). Not having node.tpl.php in your theme will cause any other node-type.tpl.php to be ignored.
What is the name of your tpl? I'd like to reproduce your steps if I can. thx.
Comment #4
caroltron CreditAttribution: caroltron commentedComment #5
caroltron CreditAttribution: caroltron commentedComment #6
j0e CreditAttribution: j0e commentedThanks Colleen, I didn't remove any of the template files. The thing is now I can't reproduce it either: suddenly, it's working for all my content types, not sure why: I assume it's nothing wrong with the theme, so I'll chalk this one up to sheer mystery. I switched hosting providers, but that doesn't seem to be the reason. Anyway, thanks for looking into it. I appreciate it very much.
Comment #8
robato CreditAttribution: robato commentedThis is happening to me as well right now. I have an underscore in my content type name. Does anyone think that may be the problem?
Comment #9
alanpage CreditAttribution: alanpage commentedUnderscores in your content types are not converted to hyphens in the template suggestions for node templates (D6). In /includes/theme.inc the code uses the actual content type, but the comment suggests that underscores will be removed:
So a content type of my_content_type would produce a template suggestion of:
and not:
The Theme developer module (dependent on Devel, but a separate project now) showed me what the suggestions were for my node, despite what the Working with Template Suggestions (http://drupal.org/node/223440) doc page says: "Use hyphens instead of underscores for consistency." That should say, "unless your content type has an underscore in it."
Comment #10
Haren CreditAttribution: Haren commentedThis is happening to me as well right now.
My content type has undescores - and i've all possible variations. (and yes i have other .tpl.php-files that works)