CHAPTER 5 • The Child Theme Concept 129
After these three steps, things get a bit more fluid. Start creating child themes that fit the
various sites in your network and roll them out. When your network is built completely on
child themes, and you want to add a common feature, you only have to do that in the main
parent theme. Upgrade it across the network, and suddenly all the sites will have this new
feature. Compare that to having to actually implement it in every theme, which is at best a
tedious copy-and-paste exercise, and you’ll understand that there is time and potentially
money to be saved by using child themes.
DON'T FORGET ABOUT FUNCTIONS.PHP
It is not just on the design front where you can benefit from using one main parent theme and
any number of child themes across your network: Pure functionality can gain from this, too.
Remember, you can have your very own functions.php file for every theme, both the main
one and the child themes, which means that if you’re PHP-savvy, you can create plugin-like
functionality on the theme side of things.
Another of the things people running multiple sites need to tackle is the maintenance of
plugins. Granted, this is a lot easier these days, with upgrade functionality from within the
WordPress admin interface, but some of the tasks you use plugins for can in fact be done just
as well from within your themes. Although you can have those cool things in your theme’s
template files, whether it is a parent or child theme, it just isn’t all that convenient. Besides, the
whole idea with themes in the first place is to separate design from code, so filling the
template files with more PHP snippets than usual kind of works against that purpose.
This is where functions.php may be an acceptable middle ground. After all, it is a template file
outside of the design part of the theme, existing purely to add extra functionality through
PHP coding. So it may be a better idea to write general functions in the functions.php file of
the main parent theme rather than maintaining plugins that do the same thing across all sites.
This strategy can also help reduce the maintenance burden for a network with several sites.
Just don’t forget about data portability; after all, you want your site to work as intended even
when you swap themes, right?
THERE IS SUCH A THING AS TOO MUCH
Child themes are great and something you should consider using; that much should be clear
by now. However, there is such a thing as too much, as well, just like with regular themes. For
example, although the functions.php file in your child theme can be useful, you should
probably consider creating a brand-new theme if it gets too advanced. The same goes if you
end up overwriting a lot of template files in the parent theme: Perhaps it is a better idea just to
fork the theme and create a new one instead.
There’s also the issue of updating the child theme. If you end up with a child theme with a ton of
new functionality that needs to be maintained, you might have missed the point of using child
themes in the first place. In a perfect world, everything you need to maintain is in the parent
theme, and minor changes and additions are in the child theme. Don’t forget about that; if things
get complicated and just keep growing, you should consider creating a new parent theme instead.