What’s up programmers? I am back with the idea about wordpress child theme by our user and admin request of w3Programmers. As wordpress is most popular platform to build website with full functionality, 85% of users customize their themes, and only 35% use a child theme. This may be due to a lack of understanding as to what a child theme is, or due to the perceived difficulty of creating one. No problem Programmers, today I want to develop a wordpress child theme which will work by a parent theme.
What exectly wordpress child theme is
A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme. Child theme allows you to modify, or add to the functionality of that parent theme.
Why use a Child Theme?
- If you modify the parent theme and it is updated the new version, you will lost your changes. To use a child them you will never lost your changes.
- Your parent theme must be updated for security or functionality reason, so to use a child theme is better then the best.
- LoL programmers –> it can be speed of your development.
- Also it is a great start, if you are just learning the wordpress theme development.
How to build Child Theme
The below image is states clear way to arrange a child theme folder in wordpress theme directory.
The style.css, this is the only file required to make a child theme. Also I added a screenshot.png. The style sheet must start with the following lines (Here DevBD is example)
/* Theme Name: DevBD Child Theme URI: http://www.devbd.com Description: DevBD Child Stylesheet Author: Rashad Author URI: http://www.debbd.com Template: devbd Version: 1.0 */ @import url("../devbd/style.css");
You can change each of these lines to suit your theme. Whatever your Theme Name, Theme URI, Description, Author, Author URI and Version, there is no problem. Only be careful about your Template, Template: Must be your parent theme folder name.
Also I use @import url to include the parent theme style which is loading in our child theme. The following image is wordpress Administration Panels Appearance > themes:
Go to Administration Panels > Appearance > Themes. Your child theme listed there. Click Activate.
Now you can develop your child theme with custom features to use php template file and/or function.php file to register or create special something in your website.
And if you want to do something more critical on your child theme please visit wordpress child theme codex