fbpx Adding new regions | ComputerMinds Skip to main content

Adding new regions

An article from ComputerMinds - Building with Drupal in the UK since 2005.
18th Sep 2007

Mike Dixon

Senior Mind

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.