Redefine Regions When Creating a Subtheme

Published June 17, 2009

When creating a sub-theme, if you want to add a new region to it, you must remember to redefine the default regions - or bad things will happen.

Here's an example: let's say you're creating a new theme called "squirrel" based on the 960 theme. Since the 960 theme uses Drupal's default regions if you just add your new region to the squirrel.info file, you'd find that all of your inherited (default) regions are now gone and your admin/build/block page is full of messages saying that all your blocks have been disabled.

Drupal provides the following regions by default:


regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer

If the base theme doesn't specify any regions, these are the ones that are available. If, in your subtheme, you want to add a new region called "Above content". You'll need to add the following to the squirrel.info file:


regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer
regions[above_content] = Above content

Check out this page on Drupal.org for additional information about inheritance in subthemes.

Sign up to receive email notifications of whenever we publish a new blog post or quicktip!

Name
CAPTCHA