Add new regions in Drupal 7 themes

Most Drupal themes have a number of pre-defined regions that you can use in your templates (.tpl.php) files. But what if you want to do something a bit more creative with your web site? For example, if you are using MD Minimal theme with only 3 block regions (highlight, help & content) and you need add social icons block in footer. So, here's a tutorial on how to create custom regions in your Drupal 7 themes.

Step 1: define the custom region in your theme's .info file

The .info file for your Drupal 7 theme will be located within the root of the theme's main folder. e.g. MD Minimal's .info theme file is located at: /themes/md_minimal/

Open up your theme's .info file and you should see some regions like this:

regions[highlight] = Highlight
regions[help] = Help
regions[content] = Content

to add a new region just type in a new one in file.

regions[footer_icons] = Footer icons

Print out your new region in page.tpl.php file:

<?php if ($page['footer_icons']): ?>
  <div class="footer-icons">
    <?php print render($page['footer_icons']); ?>
  </div> <!-- /.footer icons -->
<?php endif; ?>

Save file, clear your cache (go to admin/config/development/performance) and you will see the new region.

Related post

Have More Idea?

We are here to build your website!

No Universal solution fits all special business requirements. Our experienced team is ready with ideas and state-of-the-art technical solutions to consult the best solution within your budget.