Creating a Page Template Suggestion for a Specific Node Type in Drupal 7
March 17 2011 01:51:49 PM
Add the following function to the template.php for your theme:function yourthemename_preprocess_page(&$vars, $hook) {
if (isset($vars['node'])) {
// If the node type is "blog" the template suggestion will be "page--blog.tpl.php".
$vars['theme_hook_suggestions'][] = 'page__'.$vars['node']->type;
}
} Change the "yourthemename" in the function name to match the name of your theme.
- Comments [0]