I'm running Drupal 7, and working with the Zen theme. I'm pretty sure I created a child-theme of Zen. My file structure looks like sites/all/themes/mytheme, with the original zen being located in sites/all/themes/zen. Not sure if any of that matters.

Anyway, I've created a custom content type and now I'd like to style the page differently (not just the node, but the entire page).

I've copied my page.tpl.php file and renamed it page-mycustomcontenttypename.tpl.php. This file is located in the same directory as my page.tpl.php file, which is sites/all/themes/mytheme/templates.

I then added the following code to template.php, which is in my theme's root folder:

* Add / modify variables before the page renders.
function phptemplate_preprocess_page(&$vars) {

// custom content type page template
  // Renders a new page template to the list of templates used if it exists
  if (isset($vars['node'])) {
    // This code looks for any page-custom_content_type.tpl.php page
    $vars['template_files'][] = 'page-'. str_replace('_', '-', $vars['node']->type);  

I then clear my site cache, but the changes I make to the custom template don't show up.

There's about a million places I could make a misstep here, so I'm not sure where to start? Any help is appreciated!

  • You can also find more information here.
    – Rylyn
    Jul 15, 2013 at 9:24

1 Answer 1


I'm totally an idiot. I tried this code previously but it didn't work, which is why I ended up with the code above (also didn't work).

I realized that in the code I tried the first time I failed to change the first line to my theme's name:

function thisshouldhavebeenmythemename_preprocess_page(&$variables) {
  if (!empty($variables['node'])) {
    $variables['theme_hook_suggestions'][] = 'page__node_' . $variables['node']->type;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.