Site icon WP Smith

A Theme Framework, Child Themes, & Grandchild Themes

Parent, Child, Grandchild ThemesGrandchild themes? Really? Yes, they are possible but not popular with many lead developers arguing against this practice. Justin Tadlock, for example, writes an excellent post against the argument of creating grandchild themes, which PostStatus concurs with an apt statement: Grandchild themes solve "a problem to a bad architecture." While I am not sure that it is "a bad architecture" per se, but more a bad practice that creates a bad architecture.

Are grandchild themes possible? Yes. Are they maintainable? Yes with some great difficulty though not scalable. Is there ever an instance where it should be used? Possibly. The only scenario I can conceive is as part of an internal multi-site/sub-sub-site but besides this rare occasion, at the moment I cannot think of any that would justify the use of a grandchild theme over developing via branches.

So, let's look at these four: theme frameworks, parent themes, child themes, and grandchild themes a bit more closely.

Theme Frameworks

Justin Tadlock defines a theme framework as...

a set of conventions to use for developing WordPress [parent] themes.

Yet, I would differentiate between a a framework from a theme framework using the former in its more pure scope meaning "a reusable set of libraries, functions, classes for a system" or as Justin defines it "a set of conventions." A theme framework, on the other hand, is a parent theme that implements a framework. A framework displays nothing on the front-end or the back-end. In WordPress terms, a framework does not include or require to contain a functions.php or a style.css, as Hybrid Core. If I carry this to other themes or theme frameworks, I believe that "themes" like Genesis are theme frameworks as their primary purpose is to be extended and serve as a framework, yet there is a front-end and a back-end that is ready to be used and customized out-of-the box.

In other words, a theme framework is a parent theme or an advanced parent theme, as some call theme. Genesis, a theme framework, is an advanced parent theme.

Parent Themes

A theme is a completely new front-end layout of a WordPress site. While theme frameworks are always parent themes, not all parent themes are theme frameworks. Just like how all squares are rectangles ut not all rectangles are squares. Suares are a specific subset of rectangles.

Parent themes can be a fork of a theme framework as part of its core, and a parent theme can be a theme that sits on a framework within itself. Simply, parent themes use the WordPress installation and adds various forms of presentations and formats.

Child Themes

A Child Themes is:

a theme that inherits the functionality of another theme, called the parent theme. Child themes allow you to modify, or add to the functionality of that parent theme. A child theme is the safest and easiest way to modify an existing theme, whether you want to make a few tiny changes or extensive changes. Instead of modifying the theme files directly, you can create a child theme and override within.

As Justin later notes, child themes solve the problem of safe upgradability, which is imperative. For example, if you update and customize Twenty Eleven or Twenty Twelve, every time WordPress upgrades, you get in danger of losing all or some your theme customizations. However, if you use a child theme of those, then you can easily update without thinking twice. This is one reason why the upgrades of Genesis go so smoothly!

Child themes are typically done as a WordPress theme, and there are two plugins which assist you in making child themes:

  1. Child Themify (Downloads: [plugin_info slug="child-themify" data="downloaded"]): [plugin_info slug="child-themify" data="short_description"]
  2. Orbisius Child Theme Creator (Downloads: [plugin_info slug="child-themify" data="downloaded"]): [plugin_info slug="child-themify" data="short_description"]

Grandchild Themes

By default, WordPress cannot create a grandchild theme even though Smashing Magazine wrongly states this. However, Mark Barnes and AppThemes write a great tutorials on how to create a grandchild theme.

So why do some people believe they need to have grandchild themes? Theme shops like StudioPress focus on creating child themes that modify Genesis, the parent theme framework, with a few different functions, etc. Recently, Genesis has been updating some of these themes (e.g., Lifestyle, Outreach). However, in these updates, many have a new slug which forces people to properly upgrade a site manually. However, Lifestyle (among others), for example, did upgrade with the same folder slug. So having a site created based on this child theme that implemented a grandchild theme workflow would make maintenance, err upgrading, easier. However, in my opinion, this complicates the workflow, harms the client (who would just click upgrade without thinking through the ramifications and implications as would some novice developers), and is a lazy approach to keeping up code on a site. Furthermore, the upgrade in a Genesis child theme is never security as that is 100% addressed in the advanced parent theme. Instead, these upgrades are purely aesthetic.

In the comments of Mark Barnes's article, Eric Mann gives a great rationale and better workflow to editing a child theme than using grandchild themes stating:

If you are using a child theme for a system like Genesis, then you should fork it rather than try to hack your presentation into a plugin. Throw the current version of the child theme into Git or SVN, then create a dev branch to contain your customizations. If (and this is a big “if” since most won’t) the child theme is update, you can create a diff between the original and the new version using your VCS and apply the diff to your branch.

Is it more work? Yes. Is it an ugly hack using a plugin? No. Work with what you have, but don’t advocate a system like this that introduces a third level of moving parts into the theme’s presentation

Eric previously gives these reasons against Grandchild themes:

  1. Arbitrary limitation would need to be imposed on theming.
  2. A difficult, near impossible troubleshooting workflow
  3. Multiple developers, multiple development patterns
  4. Theme distribution of a grandchild theme is untenable

Conclusion

Personally, I don't believe grandchild themes will ever be implemented or supported in WordPress core, and rightly so. I believe that developers should seriously consider the relationships between their theme frameworks and child themes and possibily create a workflow that resembles a true framework, multiple advanced parent themes, allowing their customers to implement with child themes. However, with theme shops like Genesis or Thesis, this is more difficult as the advanced parent themes generate a lot of revenue. So, besides being a change within a development model, it would be a change in revenue and business models for them. And both models work well and address different user/client needs. I think StudioPress has created an excellent model which Nathan Rice, the lead developer behind Genesis, writes:

I was convinced that users would have a hard time with the Genesis concept, but to my surprise, we've evidently stumbled on something that users really love. My guess is that grandchild themes, or any attempt to synthesize that concept, would disturb the balance of an otherwise extremely popular methodology.

Have you ever used grandchild themes? Ever heard of them? Think they are a good idea? bad idea?