Since January I’ve been rewriting the WordPress theme WPFolio as a Thematic child theme. Everything was ready for release, but then I came across Justin Tadlock’s article Frameworks? Parent, child, and grandchild themes? and reconsidered the choice to release a child theme.
Framework → Parent → Child
I’ve always tried to make modifying core theme files a last resort, but that’s not necessarily a good way to work as a theme developer. Child themes are great for individuals looking for relatively minimal changes (this blog for example), but when it comes to actually releasing a theme, parents are the way to go. First of all, there is no such thing as a grandchild theme, so users wanting to make changes will be editing the core files which is bad news – anyone making changes will never update because they’ll lose all their changes. Secondly, child themes are not yet in the WP.org theme repository, so you’d have to rely on word of mouth. And finally, it will be confusing for inexperienced users migrating from WPFolio to the child theme WPFolio Two.
About frameworks, Justin Tadlock describes them like this:
Frameworks are for theme developers. They offer a set of standards (or whatever features) for theme developers to use in creating their own themes. They’re a set of functions/features created to aid development.
I interpreted that as a sort of bare-bones parent theme. But then he elaborates on how frameworks should work:
• Frameworks come packaged within a single folder.
• Developers drop the framework folder into a new parent theme and load the framework.
• Users create a child theme based on the parent theme to house their customizations, allowing both the framework and parent theme to be updated.
According to this description a theme framework would exist more like a plugin for parent themes – to be kept untouched and update-ready in one folder. This is definitely not how many frameworks are used. Thematic sort of functions like this via child themes. When child themes are included in the wp.org repository, it looks like this functionality will be a standard. In any event, it’s all very controversial.
What’s Cool about Thematic
I’m definitely sold on the parent theme/anti-grandchild argument here. So, WPFolio Two the Thematic child becomes a parent and here’s how I’m doing it.
Thematic is set up so that all theme files consist of calls to functions in
library/extensions/. There, each function has a quick conditional like this:
To change the page title in a child theme, all you have to do is copy and paste the page title code into your child theme’s functions.php into a function called
childtheme_override_pagetitle(). Thematic then execute your child theme function instead of the default. Easy peasy.
This makes merging WPFolio Two the child with Thematic pretty simple. With this function for example, I replaced thematic_page_title() with my childtheme_override_page_title() and changed the name to wpf_page_title(). Then I found where thematic_page_title() was called (in category.php) and again changed it to wpf_page_title(). This way, I’m keeping Thematic’s child theme friendliness intact and making clear tabs on the code I’ve changed. Check it out for real: