Everybody wants to tweak their theme a little bit. But the problem becomes when you are tweaking your theme directly and the developer releases an update where there’s a chance that the files you are working with, gets updated. When this happens your tweaks will be gone. In that case, you will have to redo everything.
Why to create child themes for WordPress?
If you are running a child theme it uses the core functionality of the original theme but your styles and your changes are overlaid on top of it. So you can update the core files but your overlay, the child theme still exists and is still intact. Depending on the changes made by the developer you might have to make some minor tweaks but your original code is all still there. So you can just pop in there make some minor tweaks and you are ready to rock and roll! That’s the biggest reason people create child themes.
How to create a WordPress Child Theme
You have to head into Cpanel or Login to the website via FTP.Find the file manager icon.
file manager directory
Find the domain name where you want to create the child them and go into `wp-content’ folder and in the themes folder and create a new folder called `Avada-child’ for convenience sake and for readability.
The next to you wanna do is to set the child theme and there’s only one file that’s required for your child theme which is the style.css file. The functions.php files are highly recommended but the style.css is the only one that’s required.
Click on the new file button on the top left and create the style.css file
create new file
And if there is something very specific you have to write into this file, what you gonna do is
go back to your active theme and find the style.css file.
Click on Edit to copy the whole first section where it has information about the theme.
edit theme section
You can go back to your new child theme, open the CSS file and paste what you copied. There are a couple tweaks you need to make to this information to make an official child theme. So you can add child at the end that is what will show inside the WordPress dashboard with the in section that is the title that will show up. On the second line create you can create something called template and it’s gonna be called `Avada’. This Avada is taken from the folder named Avada. The template name is case sensitive so you wanna make sure you type it exactly how this folder is case sensitive. And that’s all there is to it, you now have a child theme.
avada child theme
You will save this and go into your manage themes. Here you don’t have a thumbnail obviously, but this is the child theme. If you click on `Activate’ it will become the active theme. But as you know the CSS file is completely blank, you are loading essentially a blank style sheet. So if you go to our website and refresh the page it’s going to be broken. What you need to do is to import the parent CSS file from the original theme. But a better method is to create the functions.php file.
For that create a new file by clicking on the new file button and then type in functions.php and into this file will paste a simple function that will pull the parent style sheet into the child theme. Functions.php is where a theme’s main functions are typically stored. A parent theme’s functions are always loaded with the child theme, but if you need to add more custom functions to your theme then you can do so by creating a new functions.php file within your child theme folder. The new functions will be loaded right before the parent theme’s functions. Your child theme’s functions.php file should start with a PHP opening tag and end with a php closing tag. In between, you can add your desired PHP code.
To summarize, you need to create a new folder inside your themes directory which is called the theme name-child. Inside the folder, you could recreate a style.css file from where you copied the theme legal information from the parent theme into the child theme style sheet. All you need to do is to change the name in that style sheet. Then you need to add the functions.php file and pasted the code in there to pull in the parent’s style sheet.
So if you follow these steps you can easily create an up and running child theme which is awesome!!
Sarah is a passionate writer and blogger. As an early adopter, she enjoys trying out new social media and Internet tools along with WordPress plugins and Web apps.
Latest posts by sarah ali (see all)