Creating a New Subtheme

Install the Zen theme if you have not done so before now; once that is done we're ready to create a new subtheme.

^ Installing a new theme is covered in Chapter 2. J

First, make a copy of the directory named STARTERKIT and place the copied files into the directory sites/all/themes. Rename the directory "tao".

[ Note that in Drupal 5.x, subthemes were kept in the same directory as T

.rlsT^ the parent theme, but for Drupal 6.x this is no longer the case. Subthemes I

should now be placed in their own directory inside the sites/all/ I

themes/ directory. -I

Note that the authors of Zen have chosen to vary from the default stylesheet naming. Most themes use a file named style.css for their primary CSS. In Zen, however, the file is named zen.css. We need to grab that file and incorporate it into Tao.

Copy the Zen CSS (zen/zen/zen.css) file. Rename it tao.css and place it in the Tao directory (tao/tao.css).

When you look in the zen/zen directory, in addition to the key zen.css file, you will note the presence of a number of other CSS files. We need not concern ourselves with the other CSS files. The styles contained in those stylesheets will remain available to us (we inherit them as Zen is our base theme) and if we need to alter them, we can override the selectors as needed via our new tao.css file.

In addition to renaming the theme directory, we also need to rename any other theme-name-specific files or functions. Do the following:

• Rename the STARTERKIT.info file to tao.info.

• Edit the tao.info file to replace all occurrences of starterkit with tao.

• Open the tao.info file and find this copy: The name and description of the theme used on the admin/build/themes page. name = Zen Themer's Starter Kit description = Read the <a href="http;//drupal.org/node/226507">online docs</a> on how to create a sub-theme.

• Replace that text with this copy: The name and description of the theme used on the admin/build/themes page. name = Tao description = A 2-column fixed-width sub-theme based on Zen. Make sure the name= and description = content is not commented out, else it will not register.

• Edit the template.php file to replace all occurrences of starterkit with tao.

• Edit the theme-settings.php file to replace all occurrences of starterkit with tao.

• Copy the file zen/layout-fixed.css and place it in the tao directory, creating tao/layout-fixed.css.

Include the new layout-fixed.css by modifying the tao.info file. Change style sheets[all][] = layout.cssto style sheets[all][] layout-fixed.css.

The result of creating our new subtheme and re-naming the files.

The result of creating our new subtheme and re-naming the files.

The .info file functions similar to a .ini file: It provides configuration information, in this case, for your theme. A good discussion of the options available within the .info file can be found on the Drupal.org site at:

http://drupal.org/node/1712 0 5

0 0

Post a comment

  • Receive news updates via email from this site