Many WordPress themes come with customization features that you can utilize without needing to make any code changes. Many themes allow you to make simple and complex customizations to the theme all within the WordPress dashboard. But sometimes, the theme your site uses may not have a way to alter something within the dashboard, requiring you to modify the files of your theme in order to make the change. In this article, we’ll discuss the safe way to modify your theme’s files by using a Child theme.
What is a child theme?
A child theme is a WordPress term for a theme that references another theme as it’s “parent”. When a theme has a “parent theme”, it will inherit the files from that theme and allow you to add your own functionality and alter or override files or functions in the parent. The changes are made in the child theme so you’re not actually modifying the parent theme’s files at all.
You can make a child theme or use one provided by the author of your theme. Many themes will provide a child theme you can download from the theme’s website. This is especially true if you have a premium theme that has more extensive customization options, such as Avada.
Need some tips on choosing a theme? Check out our other article: How to Choose a WordPress Theme.
You can read more about Child Themes in the WordPress Theme Handbook: https://developer.wordpress.org/themes/advanced-topics/child-themes/.
When you should use a child theme
In general, if you need to modify the files in your theme or alter their behavior you likely need to use a child theme. If you’re using a plugin that has a system for template overrides such as WooCommerce, you should make sure to use a child theme.
If you’re using a premium theme its good to just use a child theme upfront, even if you’re not needing to make more advanced customizations right away. Typically the theme author will provide the child theme, so you just need to install and activate it and you’re all set.
Why you should use a child theme
WordPress themes often receive updates to fix bugs, correct security issues, or add new features. If you’ve made changes to a file that has been updated by the theme author, performing that update will erase your changes. If you’re using a child theme, the file you changed won’t ever be overwritten by an update to your parent theme.
However, if you’ve made changes to a file that was updated in the parent theme, you may need to make an update to your version of the file to make sure nothing breaks. If your child theme includes a file that is also in the parent theme, the child theme version will override it. The only files that have different behavior are
style.css. These files are unique to your theme and do not override the equivalent files in the parent theme.
A child theme is installed and activated just like any other WordPress theme, so using one is approachable for both non-coders and developers alike. If you’ve already started setting up your theme without using one you can always choose to do so at a later time. Just keep the thought in mind if you’re ever needing to modify or add to your theme’s files.