Warning message

Documentation is currently being migrated into the new system. Some pages might be temporarily missing, and some guides might appear empty. Thank you for your patience while we are improving Drupal.org documentation.

Theming Drupal 7

Theming guide for Drupal 7.

Overview of theme files

A theme is a collection of files that define the presentation layer. You can also create one or more "sub-themes" or variations on a theme.

Writing theme .info files

The .info file is a static text file for defining and configuring a theme. Each line in the .info file is a key-value pair with the key on

Default .info values

The following are the assumed defaults. When they are not defined, the theme will automatically take these values.

Assigning content to regions

If none are defined, the following values are assumed in Drupal 6.

Checking to see if a region is occupied

While theming page.tpl.php it's possible to check to see whether a region is empty, by checking the content of the relevant variable which

Theme settings

Various page elements output by the theme can be toggled on and off on the theme's configuration page.

Global Settings

Next to List, select configure. This will show the global theme settings option where you can toggle the display of features supported by

Integrating color module

Color.module allows the admin to change the color scheme of a theme. By selecting a palette of colors (either from a set or by hand), you

Creating a sub-theme

Sub-themes are just like any other theme, with one difference: They inherit the parent theme's resources. There are no limits on the

Clearing the theme cache

The contents of the .info file is cached in the database, so altering it will not be noticed by Drupal. Also if you add new tpl.php files or

Sub Theme - Inheritance Summary

In the previous section, We understood how sub theme is created along with inheritance of various properties. Below list summarises the

Example: Creating a Garland Subtheme That Utilizes the Color Module

Let's say you want to use Garland as your base theme, but want to be able to make CSS tweaks to it and want to keep the Color module

Working with CSS

Working with CSS in Drupal 7.

Working with JavaScript and jQuery

Using JavaScript adds dynamic presentation effects to a theme. In addition to custom JavaScript files many Drupal developers find jQuery

Using Newer Versions of jQuery

You will often need a newer version of jQuery to use a certain jQuery plugin. There are several ways to achieve this.

Core templates

Core comes with a number of default template files. You can override these templates in a number of ways.

Template (theme hook) suggestions

A theme hook suggestion is an alternate template (.tpl.php) file that you have created to override the base or original template file.

Theming blocks

Theming blocks in Drupal 7 individually, by region, or by module.

Advanced theming

Advanced theming in Drupal 7.

Overriding themable output

Overriding themable output in Drupal 7.

Creating accessible themes

This guide provides a guide to accessibility best practices for theme developers.

Theming HowTos

Theming HowTos for Drupal 7.

Tools and best practices

Best practices and conventions for theming Drupal 7.

Upgrading 6.x themes to 7.x

NOTE: We are now using a different system to track version-to-version changes in Drupal. Most of the theme changes between Drupal 6 and

Guide maintainers