Towards the end of 2015 I shifted my working method and started using the Parent and Child functionality of WordPress themes to power all my new clients websites.
Previously to this I used a Starter Theme that got customised to each individual clients needs.
What is a Starter Theme?
A starter theme is basically a bit of a head start to a theme, all the basics are covered. So rather than starting a new theme from scratch you have a set of files that you use on all your clients websites. You then add what’s needed to make the theme suit your clients needs.
This worked fine for a few years, but as business grew, and the number of clients increased it became more difficult and time consuming keeping all the sites technically up-to-date.
Updating a Starter Theme
The trouble was that the customisations could be in any of the files, ok it isn’t really an issue to find them for me as I keep everything under version control, but looking for, and duplicating multiple files across multiple sites isn’t very enjoyable.
What is a Parent Theme?
Short answer: A Parent Theme is any theme that isn’t a Child Theme.
Although any theme can be used as a Parent Theme not all make great Parents. How easy or difficult it is varies from theme to theme. Mostly this is down to how much thought the developer gave to the theme; making functions pluggable, including files and scripts properly. But any well coded theme can be used as a Parent.
Choosing a Parent Theme
Most people will find a Theme that closely matches what they want their website to look like. Then for any changes and customisations that can’t be done in the Theme Options and Settings will create a Child Theme and do all their customisations there.
What are Theme Frameworks?
I’d like to be clear here, anything you can upload as a theme and activate as a theme is a Theme. Whilst any theme can potentially be a Parent Theme, Theme Frameworks are usually designed to be very flexible Parent Themes; making it easy to override and change things without touching any of their files.
Personally I was already using my own Starter Theme, so this adapted to make my own Parent Theme. I made sure every part of it can be changed in a Child Theme if necessary. It’s pretty ugly on its own, but then it isn’t meant to be used without a Child Theme.
What is a Child Theme?
A Child Theme depends on its Parent Theme to work, if the Parent Theme isn’t present the Child Theme simply won’t work.
A Child Theme inherits all the functionality and styling of its Parent Theme. So you can do all your customisations in the Child Theme without touching any of the Parent Theme’s files. So when it comes to updating your Parent Theme you can do it safe in the knowledge that none of your customisations are going to be overwritten by new files. Perfect, well almost.
This method has served me well for 2 years now. After each project I take a look at what improvements should be adopted into the Parent Theme for future clients to benefit from, and an update offered to past clients.
So each of my clients gets the Parent Theme, and a Child Theme – customised to their needs. A recent client asked if their Theme could be used on another of their websites – but with a few changes to styling and some other functionality added.
Grandchild Themes don’t exist, and I didn’t like the thought of having two complex child themes to look after. I needed a single Child Theme – the same on both sites, that could be added to and changed a bit on the second site.
A lot of my work generally goes on in the Child Theme’s functions file and stylesheet. I use a lot of Actions and Filters in my Parent Theme, so I generally don’t need to alter too many files.
So here’s what I came up with.
My Parent Theme now checks for the existence of custom-styles.css in the Child Theme, and loads this after the Parent and Child stylesheets if it finds it. So in the Child Theme of the second site I added my custom-styles.css where all my css specific to that site.
Some changes to the functionality were also necessary, so in the Child Theme’s functions.php file I added a line to check for the existence of custom-functions.php, and if found included it before the rest of the Child Themes functions.
So both sites have exactly the same Child Themes – but site two has the two extra files in it, which change what’s necessary.
Thankfully both the sites are so close that they don’t need different templates, and, for now at least, I think if I’m tempted to work out how to use different templates I should just create a new Child Theme before I disappear down the rabbit hole.