Skip to content

Instantly share code, notes, and snippets.

@joshuapowell
Created January 26, 2012 02:16
Show Gist options
  • Save joshuapowell/1680516 to your computer and use it in GitHub Desktop.
Save joshuapowell/1680516 to your computer and use it in GitHub Desktop.
Drupal: Allow for Node Type specific page.tpl.php files (e.g., page--node--story.tpl.php, page--node--page.tpl.php, page--node--webform.tpl.php)
<?php
/**
* Implementation of hook_preprocess_page().
*/
function MYTHEME_preprocess_page(&$variables, $hook) {
// Allow for page templates, based on node type
if (isset($variables['node'])) {
$variables['theme_hook_suggestions'][] = 'page__node__' . str_replace('_', '--', $variables['node']->type);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment