If you or your WordPress developer failed to use a child theme, modifications to your website could disappear when your parent theme gets updated. Such an oversight could cost you hundreds, if not thousands in development dollars, and hours of downtime to correct. Here’s how to avoid that costly mistake.
The Purpose of a Child Theme
WordPress developers often begin with a pre-built Theme or framework. Instead of “reinventing the wheel”, we often rely on pre-coded, page grid systems and stylable modules such as menus; buttons; form components; animation scripts; and more.
These flexible building blocks help streamline the production process and make websites more affordable.
From time to time, these pre-built themes, frameworks, and modules are updated by their respective developers— to close a security vulnerability; to improve performance; to fix a bug; or to enhance functionality. When they do, the modifications your WordPress developer made to customize your website can be overwritten.
For example, if your WordPress developer’s header modifications were made directly to a parent theme, your “header.php” file will be overwritten next time your parent theme is updated.
That’s exactly why WordPress allows for, and recommends, the use of child themes.
Creating a Child Theme is Easy
Basically, that theme or framework that’s used to begin building your website becomes a parent theme when your child theme is created.
Creating a child theme only takes about 30 minutes:
- Create a new folder in your “wp-content/themes” directory
- Create a file in that folder called “style.css” and add a few lines of code
- Create a “functions.php” file and add a few lines of code
Done! Your WordPress developer just saved you many hours of frustration and fees, merely by doing 30 minutes worth of work!
Now, instead of working directly on the original “header.php” file (for example), your WordPress developer simply copies that file from your parent theme to your child theme and works on the copy. And yes, WordPress is smart enough to use the copy in your child theme, instead of the original in your parent theme.
Next time your parent theme gets updated, you won’t have to worry about losing your modifications!
What If Your WordPress Developer Didn’t Use a Child Theme?
If your website does not have extensive modifications, creating a child theme may not be so difficult.
To do this, your WordPress developer will need to back up your site and move it to a test environment. Within that test environment your developer can perform a “diff”— i.e., compare the files of your current/modified theme to the latest version of the original developer’s theme to see how they differ.
Then, your developer can begin the process of creating your child theme— by dragging changed files into your child theme folder, and restoring your parent theme.
After some testing, the new version of your site will need to be migrated back to your live server environment.
Always Backup Before Any Updates!
Whether you’re updating a plugin, or a Theme, you must always make a complete backup of your site first. In fact, if you don’t have a backup strategy, maybe you should work on that one first. 🙂
* These instructions aren’t meant for developers— you can find detailed info in the WordPress Codex.