Hi and welcome back to this WordPress course by Bizanosa.com. In this video, we are going to learn about child themes ( WordPress Child Theme).
I will first show you how to create the wordpress child theme manually, and then I will show you a plugin which you can use in creating the child theme.
So let’s get started .A WordPress child theme .A child theme will inherit the functionality and styling of the parent theme. Child themes are a way for you to safely modify any theme.
So, if you make changes to a parent theme and you update that theme, without using a child theme, when you update that theme, all the changes you’ve made, all the customizations you’ve made will be lost. That is why every time you create a WordPress website, the first thing you need to do once you choose your theme is to create a child theme.
You can go to this page and read all of this, it’s not much. What we are interested in is how to create the theme.
To create a child theme, we’ll create a directory. Then we’ll create a style.css and then a functions.php . In our style.css file ,we will have this. And then we’ll create a functions.php to en-queue our style.
So this is the newest way of creating it.Initially , you’d just use this and then import the old stylesheet of the parent theme. First, I will create a directory for the child theme.
We are creating a child theme for our WordPress 2015 theme. Then, in that directory I will create a style.css then I will create a functions.php .
I’m here in my WordPress directory. I will go into wp-content , then I will go into themes . I will create a new folder .And I want to create a child theme for 2015 theme, so I can just call it twenty fifteen child .
Then inside here I want to create a style.css file which will let WordPress know that this is a child theme for 2015 . I will then open sublime text And I want to navigate to that folder .So it is in XAMPP, htdocs ,wp for beginners , wp-content ,themes ,twenty fifteen child. Then I will select folder .
Then I will come here and create a new file .Then CTRL S .And I will call it style.css . I will then go to WordPress and scroll down ,here. I will select this .
Theme Name, this is the name of your child theme. You can call it anything. So since this is for that theme that I’m using ,I will just call it 20 fifteen Child .You can call it anything .
Then , Theme URI .You can put your website link right here.
Description, you can describe the theme. This is what appears on the WordPress dashboard theme area .
Then Author, Bizanosa.com . Author URI, I will put the same link.
Then Template is twentyfifteen. So , here ,the Template ,you will give it the same name ,that template. You will write it exactly the way it is here.
Then you can give it a version, all of these you can change or not.
The next thing I need to create is what we call, functions.php . This is to enqueue styles, just copy it the way it is, even if you don’t understand what this is all about.
So this is a way to tell WordPress that this is the location of the style.css for the parent theme.
So, once we create that, and come back into themes, and refresh this page. You will see that we have our child theme here. I haven’t added a screenshot, so let me go back and show you how you can add a screenshot.
I will copy this image ,then bring it into twenty fifteen child .I will paste it in there .And then I will rename it to. If I go back and reload. So let’s activate it .
So you can see this error here. That is a very silly mistake that I’ve just made .So this is a PHP file .And I need to let the system know that this is a PHP file .So make sure you add this .Add it at the very top of the page.
If I go and visit the site, you will see that it’s just the same, except we’ll have to add our menu location again. I will go into customize ,Menu locations .Then primary Menu was main Menu .Social Menu was social links. Save and publish. And now you can see our menus are back.
So, to create a child theme , you just need a style.css and a functions.php .If you want to override any of the files that are here .Let’s say you want to override Header, I will just take header.php , bring it in here . Paste it there . And if I come here and open header.php . let me add something here in the body .
Then I’ll come back .You will see it is right there . So if you want to override any of these files , you’ll just copy it into your child theme and modify it however you wish.
That is the function of a child theme. So in the next video I will show you a plugin that will make creating a child theme easier for you.
So , I will see you in that next video where we are going to create a child theme using a plugin.