Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Why Use a Base Theme?

Video loading...

  • 0:00
    Why Use a Base Theme? Amber Matz
  • 0:04
    So why use a Base Theme?
  • 0:07
    One common practice in learning theme development is to use an existing example.
  • 0:13
    But modifying or hacking an existing theme makes it difficult for others to help you,
  • 0:19
    because they don't have a common starting point.
  • 0:22
    By using a parent theme, others can readily understand your starting point
  • 0:26
    and it makes it easier for them to help you.
  • 0:29
    Keeping custom development in a subtheme makes it easier
  • 0:33
    to isolate and differentiate issues from the base theme.
  • 0:37
    So, it makes it easier to isolate problems that you're having
  • 0:41
    with either your customizations or with the base theme,
  • 0:45
    and so if you're encountering a bug or an issue with the parent theme,
  • 0:50
    by turning off your subtheme you can really isolate the problem
  • 0:54
    and verify that it's actually a problem with the base theme.
  • 0:58
    A parent or a base theme provides template files, php functions
  • 1:02
    in a template.php, and other supporting files that a subtheme will inherit.
  • 1:08
    A subtheme will inherit all of these files, the HTML markup in the template files,
  • 1:14
    the CSS, and the PHP code, the preprocessing functions
  • 1:19
    in template.php. And a parent theme may also provide a starterkit
  • 1:25
    which is designed to be a starting point for developing a custom theme.
  • 1:29
    And the starterkit can be cloned into a subtheme, and provides
  • 1:33
    a basis for starting custom theme development.
  • 1:36
    This is a really good choice if you're doing custom theme development
  • 1:39
    and you have specific requirements for the look and feel of your theme
  • 1:43
    and you want an underlying structure that adheres to a certain principle.
  • 1:48
    So, for example, with Zen, if you want standards compliant
  • 1:52
    semantic HTML5 markup, using Zen as a base theme and including that starterkit
  • 1:59
    to use for your subtheme, gives the infrastructure, the bones of your theme,
  • 2:05
    a good starting point and that's more in line with your philosophy of markup,
  • 2:10
    and then that lets you customize however you wish.
  • 2:14
    It's not necessarily a good starting point if you need a lot of assistance
  • 2:19
    with the look and feel, and you're looking for something that is close
  • 2:23
    to the final visual design that you want and you just need to make a few changes,
  • 2:28
    this isn't really the theme for you because it's a very stark visual presentation;
  • 2:34
    really, the modifications are behind the scenes and the HTML itself.
  • 2:39
    And so a starter theme is a subtheme that has utilized a starterkit
  • 2:44
    and is ready for custom development. I'll be using subtheme mostly as a term
  • 2:50
    for the starter theme and I mostly use the term base theme instead of parent theme
  • 2:56
    to refer to Zen. So Zen is my base theme, and Zen Demo is my subtheme.
Loading ...

Why Use a Base Theme?


In this tutorial, I will explain what a base, or parent, theme is in Drupal and why it can be advantageous to use it in theming. We'll take a look at what is commonly provided by a base theme, including discussing what a "starter kit" is and how it is intended to be used.

Log in or sign up to download companion files.
Additional resources: