Child Themes are a best practice that I’ll be using moving forward. Any time a theme is being used (ie. any theme that isn’t built from scratch and tailor made for the client), and it requires ANY change – a Child Theme should be used.

Lots of good reasons to use Child Themes for clients:

  • When updates are made to the parent theme they won’t be lost
  • Updates will allow your customization such as branding to stay intact
  • They are super easy to implement
  • If it’s a multisite you can enable just the Child Theme (not the parent) and keep the parent safe from the prying eyes of the user / client.
  • You could use this for seasonal changes; eg. Christmas variation on a clients site, special campaigns etc.

How it Works

First a child theme must be made. All you need is a folder for the child theme and a style.css. Two important things required in the top CSS comments: 1) the Parent Theme directory, 2) the import of the original parent CSS.

When WordPress is loading pages of a Child Theme it will always look for what it needs in the child directory first. This may be styles, or files like loops, header, footer, etc. If the Child has the file – it gets used. If not, WordPress uses what the parent theme has. The one exception is function.php – WordPress will call both.

So, even if you only need to overwrite one style, or change one file (like header.php) put those in a child theme.

There is apparently a small performance hit for this.

In Action!

I have put in action the simplest Child Theme possible on the Child Theme 1 subsite. In this file I have changed the body background colour in the CSS and I have changed the header.php to prefix h1 h2 with “Title” and “Subtitle”