The Definitive Guide to Drupal 7

Creating a Subtheme

Both base and subthemes are regular Drupal themes as far as characteristics go, and any theme can be a base theme. The process of creating a subtheme is very straightforward.

  1. Start by creating the shell of a new theme. Create a directory for it, and create the .info file containing at least the name and core properties.
  2. In the .info file, add the “base theme” property containing the name of the theme you want to use as a base, like so:
    1. base theme = basethemename
  3. If the base theme has regions and/or features defined in the .info file, you’ll need to copy those to the subtheme as well.

For basic Drupal themes, these three steps are all you’ll need to do to create your subtheme. Once you’ve done this, you’ll be able to enable the theme on the /admin/appearance page. It’s also worth noting that the base theme you are using does not need to be enabled in the UI to function properly.

You are reading content from two chapters on Theme Development from The Definitive Guide to Drupal 7, written by Jacine Luisi and published by Apress on July 19, 2011. All rights reserved.