Skip to main content

The Cheeky Monkey Media Blog

A few words from the apes, monkeys, and various primates that make up the Cheeky Monkey Super Squad.

How To Have in Drupal 7 Node Type Page TPL's

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.

Node Type Drupal TPL's
  1. function themeName_preprocess_page(&$variables, $hook) { 
  2. // When this goes through the some where it changes _ to - so the tpl name is actually page--type-typename.tpl 
  3. if (isset($variables['node'])) { 
  4. $variables['theme_hook_suggestions'][] = 'page__type__'. str_replace('_', '--', $variables['node']->type); 
  5. } 
  6. }

Web Development

Would you like to know more about what we do?

View Our Services

Graphic Design Cheeky Monkey

Have a look at some our client work

View Our Work

Cheeky Monkey Discovery

Learn more about Cheeky Monkey Media

About Us