Developing websites using WordPress can be a blast due to its strong developer community and tons of free resources to pick & choose. When it comes to design, there are a ton of themes that are readily available. Some of these themes are free while others purchasable for a small fee.
In most cases, you can just utilize one of these themes to quickly set up a website for a client who isn’t too picky. There will be cases when an existing theme needs to be modified to fit the design requirements. What you don’t want to do is modify the theme’s CSS directly. This is because these themes get updated periodically and will overwrite its own CSS file. This will undo your hard work and revert the theme to its default design. This is where WordPress’s child themes come in.
What is a child theme?
In WordPress, a child theme will inherit the CSS from its parent WordPress theme. By using a child theme, you can tweak and modify an existing WordPress theme without affecting its CSS. As mentioned earlier, the parent theme’s CSS will be updated every now and then. Any modifications made to the child theme will not be overwritten by these theme updates.
Pros and cons of using child themes
⊕ Optimization tweaks and patches to security are often implemented with every update. If there is an exploit in a script that the theme uses and an updated version was released to stop it, all you would need to do is update the theme. It might be too late if you try to patch the exploit yourself as you’ll need to invest the time in researching how to mend it.
⊕ Updates are made safe because a child theme inherits its parent theme’s CSS. This lets you make tweaks and changes to the theme’s design safely without needing to modify the parent theme. You can also safely extend the functionalities of the theme without a worry because you can always revert back to an older version of the child theme.
⊗ Learning how the parent theme works is a common reason why unseasoned WordPress developers would rather edit parent theme’s CSS directly. The complexity of the theme will determine the amount of time needed to get used to its framework. Also, getting used to someone else’s code can be steep learning curve. Like many things, once you start working on it, you’ll get better at it with time.
⊗ Development abandonment can occur especially if the original developer lost interest in updating the theme. In this case, you may consider editing parent theme’s CSS directly to keep it up to date. There are cases however, where supporters of a theme would take over the project and keep it going. This is what makes the WordPress community so great.
How do I set up a child theme?
Setting up a WordPress child theme can be pretty daunting if you don’t know the ins-and-outs of WordPress development. Tony, our go-to developer for all things WordPress wrote a step-by-step process of how to set up child themes in WordPress which you can check it out here.
Conclusion
While some may suggest that using CSS plugins and modules is the way to go for smaller edits, we find that setting up a child theme is better. One of the reasons why is because you’ll never know when small changes will escalate into larger ones. Because setting up a child theme can take up some time, it is a good time invested to prepare it in advance.