Minimal Drupal 6 Theme Creation

How to get started creating a new custom theme for Drupal, using only minimal code. This is basically a combination of css-only theming, and basic intro theming.

  1. Create a new theme folder in /sites/all/themes/. Let's call it "minimal". So you should now have this folder: /sites/all/themes/minimal/.

  2. Create a new empty text file in that folder called "minimal.info"

  3. Put this essential information in it:

     
    name        = Minimal 
    description = Minimal theme. 
    core   = 6.x 
    engine = phptemplate 
  4. In your site, go to admin/build/themes and enable the new theme that now shows up: Minimal. You will still be able to use all admin features of the site, but it will look very plain. If you're scared, you can create a test user, switch to that user, and have that user select this minimal theme.

  5. Override a default template file

    • All default theming is controlled by modules.
    • So to override the output of the main page layout, find the module that is controlling it. For example, the main page layout is controlled by the system module.
    • Copy /modules/system/page.tpl.php to /sites/all/themes/minimal/page.tpl.php. The theming system will automatically detect this file and use yours instead of the default module's.
    • Add a bit of text somewhere, maybe just after the opening <body> tag, just to make sure you're overriding the default template. Do this in the new file, in /sites/all/themes/minimal/page.tpl.php.
    • Clear your cache at admin/settings/performance, and you should see the new bit of text that you added. You can proceed to rearrange other things, add, delete, however you wish to modify it.
  6. Override default CSS

    • Find the CSS file that you want to override. For example, /modules/system/system.css.
    • Copy it to /sites/all/themes/minimal/system.css.
    • add a line to minimal.info
      stylesheets[all][] = system.css
    • this removes the original from your template, and uses your new copy instead.
  7. These techniques also work for contrib modules that include .tpl.php and CSS files.

References