Why should I make a child theme
Sometimes you find a very good looking theme but you think some specific element must be removed or modified according to your taste.
Now What to do if you are not a theme developer. So there are two options you might think you can do.
- Hire a developer, pay him some money and make your desired customizations.
- OR, Look for another theme.
But if you know how to make a child theme you don’t need not to worry about it.
Just make a child theme, do some customization and make your website according to your desired layout.
So Let’s learn how to create a child theme.
A WordPress theme is a combination of template files which is responsible for the user interface, layout, look and feel of the site.
You can check our new WordPress Photography Theme “Replican”
If you want to make any changes in your site you can directly edit these files but the problem occurs when you update the theme to a latest version, you might lose all the changes you have made.
In order to save your changes so that the modifications of the theme will remain intact/unchanged, making a child theme of the parent theme is a worthy solution.
So What is a child theme?
A WordPress child theme is a theme that inherits the functionality of another theme, i.e. parent theme and allow you to modify the interface and functionality of that parent theme.
Follow these steps to create a child theme.
To create a child theme:
First we have to create a new folder in the wp-content/themesfolder named ‘parent theme name-child’ for our child theme.
NOTE- both the themes should be in a same directory.
HOW TO BUILD A STYLESHEET FOR A CHILD THEME.
We create a style.css file in our child theme folder as shown below:
/*Theme Name: Replican Theme Child
Theme URI: https://www.smallenvelop.com/
Description: Child theme for the Replican theme
Author: Smallenvelop
Author URI: http://www smallenvelop.com /
Template: replicantheme
Version: 1.1
*/
@import url("../replicantheme/style.css");
/*
Theme Name: Replican Theme Child
Theme URI: https://www.smallenvelop.com/
Description: Child theme for the Replican theme
Author: Smallenvelop
Author URI: http://www smallenvelop.com /
Template: replicantheme
Version: 1.1
*/
@import url("../replicantheme/style.css");
Now we can activate the child theme and write CSS for modifying the parent theme.
The child theme has to contain a style.css file. Then the child theme could optionally override other template files like author.php, category.php etc. The WordPress framework first looks for a template file in the child theme directory and then if not found will pick it up from the parent directory. The child theme can also add its own functions.php to add its own functions and functionality in addition to that given from the parent theme.
Hello and thanks for the wonderful Replican theme.
I found a small bug in front-page.php and thought I’d share the fix:
Change:
To:
Cheers,
Andrew.