Creating custom themes

The spam filter installed on this site is currently unavailable. Per site policy, we are unable to accept new submissions until that problem is resolved. Please try resubmitting the form in a couple of minutes.

If you want to create a custom theme, you can either customize an existing theme or start from scratch.

To customize an existing theme, just copy it to a new directory in themes, and give it a unique name. Themes should not have a name that is the same as any of the default modules in Drupal or any custom modules you might have enabled or configured. Then modify the copy as much as you want. Depending on whether the theme is template or .theme-file based, you can use PHP or XHTML/CSS to modify it. As explained above, if you only want to alter the CSS of a theme, then just place a new style.css file in a subdirectory of the theme: it will appear as a new theme in Drupal.

If you want to start from scratch, there are several ways to go. If you're not a programmer, then the easiest solution is to use one of the template engines. By default, Drupal 4.6 and previous versions comes with the XTemplate theme engine, which requires you to create an (X)HTML skeleton with special markers. See the XTemplate documentation for more info. As of Drupal 4.7 PHPTemplate changes to the default theme engine and XTemplate becomes a contributed theme engine.

Drupal themes used to be coded directly in PHP. This method is still available, but is harder to use and maintain than template-based themes.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options