If you’ve been around WordPress for more than 10 minutes, surely you’ve heard of a child-theme. I’ve tried to create a child theme in the past but ran into issues and had no patience to figure it out until a recent theme update that broke some of my customizations…I should have known better.
It was time.
A child theme in WordPress is a sub theme that inherits all the functionality, features, and style of its parent theme. Child themes are a safe way to modify a WordPress theme without actually making any changes to the parent theme’s files.
I tried to create a child theme before but I broke WordPress, I tried to follow the instructions I found on several posts, but none of them get to the point and ended up confusing me even further.
Finally figured it out.
If you don’t have file system access to the server you’re running WordPress on, move along, there is nothing for you to see here.
These are the steps that worked for me:
- Create an empty folder in your themes directory named the same as your active theme, the one you want a child theme for and append the name with -child. So, if the name of my current them is MyTheme, the new folder’s name would be MyTheme-child.
- The only other thing required is a style.css file with some basic information, but It’s better to copy the entire css file and making some slight changes illustrated below.
Style.css from child theme:
As you can see, there are just a few changes you’ll need to make in the style.css file in order to get the child theme working.
All you need to do now is copy whatever files you want to tweak from the original theme folder into your child theme folder and hack away. I would also include the theme screenshot so that it looks pretty when browsing themes in the WordPress admin portal.
Word to the wise.
If you want to make changes to your functions.php file, create a blank file named the same and add your new tweaks to it. Duplicating the file in your child theme’s folder in its entirety will break your site every time…guaranteed.