Theming Drupal 7

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

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 and Drupal 7.

Checking if a region is occupied

While theming page.tpl.php it's possible to check 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

The global settings a theme has

Integration with the Color module

The Color module allows to change the theme color scheme.

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 a sub theme is created along with inheritance of various properties. The table summarises

Example: creating a Garland sub-theme that utilizes the Color module

A Garland sub-theme that utilizes 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

ghazlewood's picture