in Web & Tech

HTML Template per Node Type

In case you need a different html.tpl.php on a per content type basis in Drupal 7

<?php
function THEME_preprocess_html(&$vars) {
  $node = menu_get_object();
  if ($node && $node->nid) {
    $vars['theme_hook_suggestions'][] = 'html__' . $node->type;
  }
}

Write a Comment

Comment