One of the most intriguing concepts in WordPress for a beginner is the child theme. The idea of having to make changes in the codes and CSS files is slightly overwhelming for a beginner and once a theme is selected, very few customisations are made by modifying the underlying codes. Any customisation if done is through the WordPress dashboard only via the theme customiser or through a plugin. However, there comes a time when a site owner grows in confidence in handling the various theme features and wants to customise certain features on his site. Not all owners are cent percent happy with the looks and functionality of the theme used, and with experience, he is usually tempted to customise the features on his site someday.
Now picture this. Your confidence in using WordPress makes you modify certain theme codes and files, and you are happy with the changed look of your site. Then one fine day, a theme update notification comes and since you are keen to keep your site secure, you click the update button without any hesitation. Once the update is complete, and when you take a look at your site, to your horror, you realise that something has gone seriously wrong. Your whole site is in a complete mess, and whatever customisations you made are all gone!
This is where the relevance of a child theme comes in. Let us understand the utility of a WordPress child theme through some frequently-asked-questions as listed below:
#1: What is a WordPress child theme?
A child theme is a theme that inherits the functionality and styling of another theme called “the parent theme”. This is to say, a child theme is the exact clone of the parent theme (the theme on which your website is run) and a child theme without any modification is identical to the parent theme. A child theme is a separate entity to the parent theme that can be created or purchased via a third party vendor.
#2: Do I need to install a parent theme to use a child theme?
Yes. It is necessary to install a parent theme first before installing a child theme. It is only from the parent theme that the child theme will be inheriting all the theme functionality. A child theme can function only if a parent theme is already there.
#3: Are modifications made in a parent theme lost when the theme gets updated?
Yes. Unless modifications are made through the WordPress dashboard via the customiser or through a WordPress plugin, a theme update overwrites all changes made in the codes in the parent theme.
#4: Should I avoid updating a theme to keep my customisations from getting lost?
Avoiding theme updates will preserve the customisations made but it is not advisable. All theme updates happen for various reasons: to fix bugs, to fix security issues and to conform to new WordPress coding standards. If you want to have a secure and healthy WordPress site, then it is essential that the new theme updates are installed whenever they are available.
#5: Does using a child theme ensure that all modifications made remain intact during theme updates?
Yes. Making changes in a child theme ensures that the theme could be updated without the fear of losing the customisations. A child theme helps maintain site security and protects all our hard work.
#6: Why do I need a child theme at all?
When you have your own website up and running, you may, at some point in time, want to make some changes here and there for aesthetic reasons or to enhance some functionality. This is possible by modifying the core files of the parent theme but doing so, there are inherent risks involved:
- You might do some serious damage by breaking the codes unintentionally.
- The modifications will get overwritten when a theme update happens.
Using a child theme ensures that all your customisations remain intact even if theme updates happen. Also, even if you do something wrong inside, you can always fall back on your parent theme.
#7: What does a child theme use?
A child theme uses a series of .php functions and WordPress-optimised commands and hooks to render the full functionality of the parent theme. When a WordPress site is run, it looks for files present in the child theme first and executes the codes it finds there. And if the codes are not there in the child theme, it looks into the codes of the parent theme to execute them. This means, if you made changes to the header.php or footer.php file in a child theme when the WordPress is run, it will execute them first. However, the file type that the WordPress doesn’t prioritise child over the parent theme is the functions.php file. In this case, WordPress executes files found in both the child and parent themes.
#8: Do I still need a child theme if I use Additional CSS for CSS customisations?
No. You do not need a child theme if all your CSS customisations are done within the Additional CSS area. Here, the customisations remain intact even if theme updates are installed.
#9: How do I create a child theme?
There are several ways of creating a child theme. These can be broadly grouped into two ways: manual method and using a plugin. Although the manual method is not too difficult, if you are not very confident, then the easy way out is using a plugin. Download the plugin Child Theme Configurator and follow the instructions. You can have your child theme created within minutes!
#10: Can I create my own child theme without a plugin?
Absolutely. In fact, it is very easy to create your own child theme. If you’re interested in gaining more knowledge on what goes into a child theme, you can try creating it on your own. That way you’ll understand the processes and know which file serves which purpose. This will only make your web development knowledge more solid. Watch the following video:
#11: How do I know if I need a child theme or not?
You don’t always need a child theme. It depends on how you want to customise your site. If you plan to modify the underlying codes of any of the following:
- CSS stylesheet
- PHP templates
- Theme’s function.php file
#12: When is child theme not needed?
If you completely happy with whatever features and functionalities that are bundled within the parent theme, and feel that you will not be needing any modifications whatsoever in the future (very unlikely though), you do not need to install a child theme. And if modifications are done exclusively through the theme customiser or the theme settings page in WordPress dashboard, you will not need a child theme at all.
WordPress themes provide a lot of flexibility in designing or customising your website. A theme might be having features that enable you to create a unique look and feel using its built-in extensions. But if you want to create a website that perfectly matches your niche, and if you’re not very familiar with having to tweak with many underlying codes, a child theme provides you the very solution. With a child theme in place, you can try out your own customisations and keep on working on them until you come up with a design and functionality that you think matches your business or niche. A child theme is a great learning tool and allows you to try different things without having to worry about wrecking your site.
If you have anything more to add to the article, please do leave a comment below. I’ll be most thankful for giving me a different perspective on things I have written here.