Sometimes a perfectly good WordPress theme comes short in a specific functionality. It is possible to improve the theme by tinkering with its css and php files directly. The disadvantage of this approach is that whenever the tweaked theme receives an important security update from its authors, all the tweaks and changes are permanently lost.
Hardcore tweakers might backup the files they have tweaked and apply the same tweaks to the theme’s updated files, but obviously there must be a better way, a less time-consuming way. And there is.
Changing a theme’s files directly makes sense only in cases when a theme is clearly abandoned for years and is not going to get an update ever again.
Creating a Child Theme
But if you are using a live theme, then it is best to create a child theme.
A child theme is a copy of your original active theme. It is better to make changes to a child theme rather than to the original, so-called
The easiest way to create a child theme is to install the One-Click Child Theme WordPress plugin.
This plugin enables you to create a child theme to your active theme by clicking
You will be then required to give a name to your new child theme — I recommend
Adding Files to the Child Theme
By default, your new child theme will only contain the style.css and rtl.css files and inherit everything else from the parent theme. To add php template files to the child theme, you need to log onto your FTP server and copy them from the parent theme’s folder into the child theme’s folder.
I recommend using the free and awesome WinSCP for this kind of work.
All you need are the access information to your FTP server — a file protocol, a host name, a user name, and a password. Your web hosting company must have provided you with these in the beginning of your cooperation.
If you have these access information, you can install and run WinSCP. Inputting the access information is very intuitive. Once you are connected to the FTP server, go to your WordPress installation’s
Select and enter your active theme’s folder. Select the files you wish to change. You can select multiple files by holding down the
Once you are done duplicating all the necessary files to the child theme’s folder, go back to
All changes you make to the child theme’s files will be preserved even if the parent theme gets updated. The child theme will use all those parent theme files that you have not duplicated into the child theme’s folder.
You don’t need to duplicate your parent theme’s functions.php file or if you already did then just delete the content of functions.php in your child theme and put there this code:
// Child theme code here
WordPress will automatically load all functions first from the child theme’s functions.php file and then from the parent theme’s functions.php file. So having the same code twice would load all functions twice.
Only add new functions to the child theme’s functions.php file, otherwise the above code suffices.
I hope that you found this tutorial helpful. If you have any questions or uncertainties regarding creating and using child themes, please, don’t hesitate to tell me in the comments below.
To learn more about child themes, read up on them in the WordPress Codex.
Liked this post?
Subscribe to our newsletter to receive early notification of new posts and deals: