It is a common practice to make changes to a WordPress theme to tweak the look and feel of the website.
Sometimes we need to change the CSS code to make design tweaks.
Sometimes we need to change the PHP code to output some custom data.
The problem is not with performing these changes.
The problem is on what kind of theme we are performing these changes.
There are two kinds of WordPress themes:
If we are performing these changes on a custom theme that is specifically built for your website, then there is no problem.
You can do whatever you want with it in terms of customization.
But if it is a third-party theme, you shouldn’t make any changes to its code files.
Usually, third-party theme developers release a good chunk of updates every year.
And whenever you perform an update on a third-party theme, all the file changes you have made inside the theme are lost because a theme update usually replaces the entire theme folder with the new version.
“Got it! But where do I add my changes?”
Don’t worry. This is where a child theme comes in.
A child theme is nothing but an extension of the parent theme.
It helps you override certain parts of the parent theme without affecting the parent theme.
And the best part is, you can preserve all the changes you make inside the child theme.
Simply put, even if you perform updates on the Parent theme, those updates will not impact the child theme in terms of file changes.
Also, be it a custom theme or a third-party theme, you can always create a child theme for it.
For example, I currently have a client who runs a multisite of 5 websites.
I created one parent theme for the overall layout and design structure.
And I created 5 child themes to address the customization needs of each subsite.