Thord Daniel Hedengren - Smashing WordPress_ Beyond the Blog-Wiley (2014)

(avery) #1

130 PART II • Designing and Developing WordPress Themes


WHAT ABOUT THEME FRAMEWORKS?


There’s a lot of talk about theme frameworks within the WordPress community. You may
wonder how child themes fit with that notion, and the answer is, of course, that they fit
perfectly well. Most so-called theme frameworks are semiblank themes that are designed for
you to modify, using either child themes or similar concepts. Some want you to put custom
code in folders within the theme, for example, so it pretty much depends on how the theme
designer envisions the usage of the creation.

However, this doesn’t mean that you’re limited to doing only what the designer intended. Any
theme is really a possible theme framework in this sense, and any theme can be used as the
parent theme for a child theme. You can always just use the theme as the parent theme and
then create your own child theme.

Some of the functionality in these themes designed to be used as frameworks for your own
creations rely on action hooks. This is basically a way for the theme to pass implementation
and data to the theme using functions.php. Then, your child theme (or pseudo-functions file
within the theme framework if that’s the solution of choice) can do things with these action
hooks, including removing them should they not be wanted. You’ll get to action hooks in the
next chapter.

LET'S TALK ABOUT PARENT THEMES INSTEAD
This is all very confusing, especially because the term framework is used so loosely within the
WordPress community, and hence here as well. Theme designers often call their themes
frameworks, which obviously is in their right. However, I’d like to argue that most frameworks
are just themes that are more suited for building new themes upon. These new themes could
possibly be child themes; that would depend on what you want to achieve. Add to that the use
of terms such as starter themes, and things get a bit muddy.

The thing to take away from this is to not think too much about what the theme designer calls
a theme. Any theme that will work standalone is a possible parent theme, and when it comes
to child themes, that’s the only important thing.

TAKING THEMES TO THE NEXT LEVEL


Understanding child themes is the first step in taking WordPress theme development to the
next level, or at least expanding it to a wider scale. You can put all your core functionality in
one theme, everything you usually put into themes anyway, and then lean on that one theme
by using a child theme that builds on it.

I’m a firm believer in saving time and making updating easier, so I think child themes are a
great idea in most cases, although there are exceptions. For example, with a very traffic-heavy
blog, you would want to cut down on anything that adds bandwidth, and in such a case, you
should consider as tight a theme as possible.
Free download pdf