I'm creating a sub-theme based on Zen 6.x-2.1 in Drupal 6.20. I've created a content type called recipe. I add the following code to template.php:
function mytheme_preprocess_page(&$vars) {
if (isset($vars['node'])) {
$vars['template_files'][] = 'page-'. str_replace('_', '-', $vars['node']->type);
}
...
After clearing the cache, page-recipe.tpl.php is recognized by the theme. I remove <?php print $sidebar_first; ?>
and <?php print $sidebar_second; ?>
from page-recipe.tpl.php. However, <body>
still contains one-sidebar sidebar-first classes (i.e. <body class="page not-front logged-in node-type-recipe page-node-157 section-node one-sidebar sidebar-first admin-menu>
). I add the following to mytheme_preprocess_page(&vars):
...
if ($vars['node']->type == 'recipe') {
$vars['classes'] = str_replace('one-sidebar sidebar-first', 'no-sidebars', $vars['classes']);
}
}
Only now <body>
renders as <body class="admin-menu">
. My goal is for <body>
to be <body class="page not-front logged-in node-type-recipe page-node-157 section-node no-sidebars admin-menu>
. Will someone tell me what's wrong?
thanks!