While working on our first Drupal 7 site we were searching around on how to make page templates for specific content types.
Here is the code we use now in our template.php, by no means is this unique but we wanted to at least have one more page out there people could use to find this trick out.
function themeName_preprocess_page(&$variables, $hook) {
// When this goes through the theme.inc some where it changes _ to - so the tpl name is actually page--type-typename.tpl
if (isset($variables['node'])) {
$variables['theme_hook_suggestions'][] = 'page__type__'. str_replace('_', '--', $variables['node']->type);
}
}
Play nice in the jungle kids!
Brian
The Top Chimp
Blog Category:
Tags: