What is child theme and why we use child theme in WordPress?
Child theme in WordPress is very important part for customize of existing theme. We can say that a child theme is modified version of parent theme.
Using child them you can easily integrate design from css of your current/existing theme and the most important advantage of using child theme is whatever changes you will perform in your child theme is not reflect in any template or any file of your parent theme.
If you use child theme it can increase your development time and also if you modify parent theme directly then your all modifications are not affected if you use child them otherwise you may lose your modifications if you not use child theme.
How to create child theme?
For child theme we need to create one main directory with style.css. Follow below steps to create child theme:
- Create folder in theme directory (Directory Path: http://domain.com/wp-content/themes) with name of “-child” of your main theme. (For example: your main theme is twentyfifteen then you can create child them folder as a name of “twentyfifteen-child”) so that you can easily identify your child theme.
- Now you have to create style.css file in same directory and put below code and modify detail as per title like (theme name, theme URI, Description, etc…) in it:
Theme Name: Twenty Fifteen Child
Theme URI: http://example.com/twentyfifteen-child/
Description: Twenty Fifteen Child Theme
Author: John Doe
Author URI: http://example.com