If you’ve ever used the term of the Framework Theme, Child Theme is probably no stranger to you. Child Theme we understand as a child theme and it will inherit all the characteristics of the parent theme (Parent Theme).
In fact, all of the theme can create child theme rather than just the Theme Framework. Because the purpose of the Child Support Theme is customizable themes without direct changes in the parent theme.
Why using Child Theme?
When using the theme, we tend to proceed directly edit the CSS/PHP code to change the theme, change the code inside. This is extremely dangerous if you later update the theme to the latest version because the changes will be lost due to the new version file overwrite.
Therefore, the use of Child Theme will help you freely customize the CSS code and without fear of being lost when updating the new version because you only need to update the parent theme, and the child theme remains the same.
Child Theme works like?
When you create a child theme, then if you copy a file in the theme folder via the mother’s child theme directory, it will execute the file conducted in child theme folder, if the folder file missing child theme it will execute the file folder parent theme.
For example, your child theme folder only every file style.css, at that time except the style.css file, other files that are executed from parent theme folder. If you copy the file single.php theme folder from mother to child theme, it will prioritize enforcement single.php file in the child theme directory, and the other files it still executed in maternal theme folder.
Particularly file functions.php of the theme Mother Mother will not be changed even if you declare functions.php file in the folder child theme, but the code inside the file of the child theme functions.php will conduct further load paralleled functions.php file inside the code of the parent theme.
So you can understand that, when using child theme that you want to customize files, just copy files over the child theme directory and modify its conduct, without touching anything to the parent theme.
The child theme of Traveler enclosed in Traveler package is called Traveler-Childtheme.
To activate the child theme:
Step 1 – Go to Dashboard -> Appearance -> Themes -> Add new theme -> Upload Traveler-Childtheme. Wait for a second.
Step 2 – Click Activate the theme.
For example, if you want to modify custom.css without making changes in Traveler code and being lost when updating, copy and paste custom.css in Traveler-Childtheme.
Step 1 – In Traveler-Childtheme folder, create a new folder named CSS.
Step 2 – Copy custom.css from Css folder of the parent theme then paste it in Css folder of the child theme. Now you can modify any parts.
3/ Child Theme usage rules to remember
- Do not delete the parent theme folder.
- Want to customize any .php file, copy it from the theme folder and edit mother-to-child theme in child theme.
- When writing CSS, always written in child theme @import line.
- In case you need to customize the template PHP file that’s not on the theme, please require it to file the theme functions.php as mother did. You see the theme’s functions.php file to see its mother somehow and do require such care.
Hopefully this short sharing can help you more clearly Child Theme and apply it to yourself to customize themes, avoid getting lost when upgrading the theme customizer.