I'm currently working on Drupal 7 project in a Zen sub-theme. Each of my region uses "region.tpl.php" as HTML/PHP template. I just created a new region called "foo". This region needs a different HTML/PHP than the other regions.

How do I make Drupal use my custom template "region--foo.tpl.php" instead of the default "region.tpl.php"?

1 Answer 1


I thought Drupal already added the theme hook suggestion for region--name.tpl.php, but if not you can add it yourself with a preprocess function in your theme's template.php file:

function MYTHEME_preprocess_region(&$vars) {
  $vars['theme_hook_suggestions'][] = 'region__' . $vars['region'];

Once you clear Drupal's caches your new template file should start being used for that region. It might be worth noting that you'll probably need a copy of the core region.tpl.php file somewhere in your theme folder as well, or the theme registry might not pick up your custom file.

  • I'm not succeeding. I added the region "foo". I populated it with blocks. I copied "region--tpl.php", added extra code and renamed that file to region--foo.tpl.php. Then in template.php I added "function aura_preprocess_region(&$vars) { $vars['theme_hook_suggestions'][] = 'region__foo' . $vars['foo']; }" and no modules are shown... What did I forget? Commented Oct 10, 2012 at 15:28
  • @Apex I think you've added rather than forgotten :) The $vars['region'] variable will already have foo in it so that line should literally be: $vars['theme_hook_suggestions'][] = 'region__' . $vars['region'];
    – Clive
    Commented Oct 10, 2012 at 15:38
  • Ok succes! I forgot to add "<?php print render($page['foo']); ?>" in page.tpl.php. So if I get this right, if region--foo.tpl.php exists it will overwrite region.tpl.php? If region--foo.tpl.php does not exists it simply uses region.tpl.php? Commented Oct 10, 2012 at 16:05
  • Yep, spot on :)
    – Clive
    Commented Oct 10, 2012 at 16:09
  • Awesome. Works like a charm. Also by removing the Zen theme's default region--footer.tpl.php the footer region finally gets the standard region template (region.tpl.php). Have been looking for that for quiet a while. Thanks a lot Clive, appreciate your help. Commented Oct 10, 2012 at 16:14

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.