A few weeks ago, I selected a WordPress theme based on a few factors important to my workflow:
- Support for multiple post-types
- Strong semantic HTML
- Bootstrap framework (for syntax portability in design)
- Active development anchored with Git
At the time I published this article, the not-named theme is not live but I’m ensuring that I’m deploying its basic framework using best practices, i.e. creating a WordPress child theme. After that’s done, I’ll proceed with the website redesign.
Why use a child theme?
WordPress allows you to install a theme from anywhere and you are allowed make modifications as you wish, in any method you see fit. However, as the adage goes, just because you can doesn’t mean you should. I was mainly concerned with theme updates and how changes by the original author would affect modifications by me.
Whenever you use an authored theme/template for any content management system, there most certainly will be updates released over time that address broken functionality, security issues, and feature enhancements. How you choose to make customizations to your website theme will ultimately affect how well (or poorly) your upgrade will happen. For example, if you dive right into the
style.css file that is included with your WordPress theme, changes you make will be overwritten if you install any update from the original author.
With that in mind, child themes work well because you can, in most cases, keep your own custom tweaks to a WordPress theme when a theme update is installed. How is that possible? A child theme is a separate directory in
wp-content/themes/ that contains overrides to the original theme you are using. Normally, this new directory will contain only a
functions.php file. WordPress will first check your
functions.php and use original theme’s code to render the website, while pulling in your
style.css overrides on top of the original theme’s CSS.
For reference on how to do this yourself, check out the Smashing Magazine how-to article.