Adding new regions

Posted on 18th Sep 2007
Takes about 1 min to read
Hey, you seem to look at this article a lot! Why not Bookmark this article so you can find it easily in the future?

Adding new custom regions (areas into which you can place blocks) to a Drupal template is dead easy ...

Simply add the following to your template.php file :


function YOUR_THEME_NAME_regions() {
 return array(
  'content_top' => t('content top'),
  'content_bottom' => t('content bottom'),
  'left' => t('left sidebar'),
  'right' => t('right sidebar'),
  'content' => t('content'),
  'header' => t('header'),
  'footer' => t('footer'),
  'new_region1'=>t('A new region')
 );
}

Make sure you change the YOUR_THEME_NAME bit to match the name of your theme (i.e. garland_regions() or computerminds_regions().

You can then reference your new region within the page.tpl using the variable $new_region1(or whatever name you give to your region).

You can add content to your new region using the block management pages (admin/content/block) - you will see that your new region appears in the dropdown list of available regions.

Published in:

Hi, thanks for reading

ComputerMinds are the UK’s Drupal specialists with offices in Bristol and Coventry. We offer a range of Drupal services including Consultancy, Development, Training and Support. Whatever your Drupal problem, we can help.