Drupal 7 Node Type Based Custom Template
In many cases of theming in Drupal we may may need a different set of header and footer. We can achieve this by writing a couple of lines in template.php for your current Drupal theme. Code snippet for Drupal 7 node type based custom template.
function yourthemename_preprocess_page(&$vars) { if (!empty($vars['node']) && !empty($vars['node']->type)) { $vars['theme_hook_suggestions'][] = 'page__node__' . $vars['node']->type; } }
Suppose you have to make separate set of look for book pages with smaller header and footer bar to give larger space to book, you can try this code in your theme template. All you need to name your file like this – page-node-book.tpl.php and see the magic.
Debdatta has more than 13 years in IT induustry and software engineering. Currently 6 years in data science, and machine learning. She holds a Master of Computer Applications degree and Executive Post Graduate Program Degree in Data Science. She is passionate about research, data-driven decisions, and technology’s role in business growth.