Learn How To Create A Child Theme in WordPress

If you are a theme developer and you should be knowing how important it is to have a child theme when you want to build something extra on the existing theme, or when you get a fresh theme updates that you purchased from the marketplace. So always have a child theme and get on the board to work something on your theme. I let you know how you can create a child theme if you are a beginner and have no idea on how to do this.
Main step to create a child theme folder
Creating a child theme as easy as you drink a cup of coffee and can be done before you finish it of. As it takes one folder and a couple of files. Before you create a child theme make sure that you have FTP such as FileZila access to add and edit the files and folder. Just log-in to your FTP and create a child theme folder by navigating to “wp-content/themes/”, this directory will contain three to four themes, each of which represents a theme installed on your site. You need to remember that it’s a common thing to use the name of the parent theme folder with “twentyfourteen-child”. For example, if you’re creating a child theme for “twentyfourteen” then it should read as “twentyfourteen-child” in your “wp-content/themes”.

As you can see, my active theme is “twentyfourteen”, so I created a “twentyfourteen-child” folder.
Creating a style.css file in your child theme folder
Once you have created your folder, you need to add the one and only file that is required to create a valid child theme – style.css. As you have no doubt guessed, this file will work as an addendum of sorts to your parent theme’s style.css file.
Add the following piece of details in your “style.css” file

The above information is more of a generic one, and you’re free to change as the way you want it to be. There is only one variable that you must alter in order for your child theme to be valid – “Template”. This variable is required in order to tell your child theme which parent theme it is related to, and must be changed to match the folder name of your active theme. Well still one more vital information to be added within you child theme’s style,css file as we have not added anything in this file yet and when you activate the child theme and you’re site shows no styling at all. Therefore, you need to call the parent theme’s CSS file within your child theme’s style.css file, with the following line of code:
@import url(“../twentyfourteen/style.css”);
Now activate your child theme then your WordPress will come to know to load the parent theme’s style.css file before executing any CSS stored in the child theme’s style.css file. To see your child theme in action, to this you need to activate your child theme. Just log into your WordPress admin and go to “Appearances > Themes” and find your child theme within the available themes and click “Activate”. After this you get the theme activation page within your WordPress admin area and you are ready to go on.
Editing your functions.php file
“functions.php” file contains all of your themes functions. In meanwhile, if you need to add up a custom functions to your theme, you can do it by simply creating a “functions.php” within your child theme folder. Make ensure that unlike “style.css” the “functions.php” in a child theme folder does not override it’s counterpart files from the parent theme. In fact, it load’s in addition, and just before the parent theme’s “functions.php”
Still, if you want to make some changes in other theme files, then the best thing you can do is that just copy the file that you want to upgrade it from your parent theme folder and paste it in your child theme folder and do the needful changes and go on with it. After your upgrade or modification just ignores the parent theme and get on with your child theme. If anything can goes wrong then just fallback to your parent theme anytime you want.




Comments
No comment yet.