WordPress is a very flexible CMS platform on which anyone could build their own website. I personally use WordPress for my freelance development, sometimes with a custom-made theme (or website template as most people know it). In this new series I’ll deep dive on how to start developing themes on your WordPress installation.
Note that this series is not aimed at the general public, but rather developers who want to start working on their own WordPress development. As such I assume you are familiar with a little bit of programming concepts, syntax, as well as front-end development (HTML/CSS/less/Sass).
WordPress Templates
When you develop a WordPress website for a client, or for your workplace, you may consider whether:
- you should do everything from scratch; or
- you should buy ready-made template and try to fit your content into it.
The problem with option #1 is that it requires a lot of research and groundwork before you even begin to style the front-end bits. Although extensible, developing theme from scratch is definitely time-consuming, and error prone.
Most people will fall into option #2, where you could just buy a ready-made template, and then simply modify your content to fit the template. The problem with this option, is that more often than not, the modifications that are made to the template requires a lot of changes, and sometimes even modifying the core of the template itself – which will be overwritten when you do a theme update.
These two options, while there are certain cases they can be useful (such as quick and easy for a no-brainer website), ultimately will yield more problems in the long run. WordPress however has a way to solve this problem: child theme.
A child theme, as you might have guessed from the term, is a totally separate theme/template that is based on another template. It uses the styles and structure of the parent theme, providing you with a base to work on which you can then further modify.
There are many benefits such as cleaner code, segregation, and scoping, but most importantly, because it exists as a separate theme, any updates to the parent theme will unlikely to break your site.
When to Use Child Theme
This is probably the most important question before you even start developing or modifying themes on WordPress. When is it appropriate to use child theme? This is especially important since there are themes like Divi, that can provide a drag-and-drop builder, full integration to the WordPress theme customizer, and so on.
The general rule is this, if you’re only modifying the styling, such as fonts, colours, background – basically minor styling tweaks that does not modify the structure or layout of the website, just use the theme customizer. Or if the theme you are using is not compatible, or does not allow you to properly tweak the CSS file, you can install plugins to help you with that.
Otherwise if your changes include modifying the structure or layout of the website, such as adding or removing HTML elements, and so on, it would be best if you create a child theme that is based on the theme you are currently working on.
Of course since our scope is to develop WordPress themes, we are going to be focusing on the child themes.
That’s it for an introduction to the series. In the next post I’ll discuss on how to setup your child theme, and start working on it.