3

I am creating custom content pages using this function in my template file

function myTheme_preprocess_page(&$var, $hook) {
  if (isset($var['node']->type)) {
    $var['theme_hook_suggestions'][] = 'page__' . $var['node']->type;
  }
}

Then I am creating a custom page--"content_name".tpl.php file for my content. However this also overrides the edit, moderate, track pages for that content as well. I only want it to override the main content page. Is there an easy way to do this.

Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
rowan.t
  • 187
  • 1
  • 10

1 Answers1

5

Change your code to be something like:

function myTheme_preprocess_page(&$var, $hook) {
  if (isset($var['node']->type) && is_null(arg(2))) { // the edited line
    $var['theme_hook_suggestions'][] = 'page__' . $var['node']->type;
  }
}
halfer
  • 19,824
  • 17
  • 99
  • 186
Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105