In Drupal 6, if you had a content type with the system name "stock-photo", you could override it using:
node-stock-photo.tpl.php
How do you do this in Drupal 7?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYou can add custom node.tpl.php
for any kind of content type like
node--[node-type].tpl.php
I would suggest you to use hook suggestion at template.php
for this :
function MYTHEME_preprocess_page(&$variables, $hook) { // Add theme suggestion for all content types
if (isset($variables['node'])) {
if ($variables['node']->type != '') {
$variables['theme_hook_suggestions'][] = 'page__node__' . $variables['node']->type;
}
}
}
So that I can have node--wine.tpl.php
for content type wine.
Note -- Don't forget to clear your cache after this :)
I think MYTHEME_preprocess_page()
function doesn't need for it.
The node--[node-type].tpl.php
is only enough for it.