Create Child Theme
Child themes provide an easy way to add custom assets, override template files or extend with more functionality. All customizations are preserved during updates of master Theme.
A WordPress child theme is used to make modifications to any part of Master theme. It has its own theme directory next to the yootheme
directory. This way customizations are separated from Main Theme which makes them portable, replicable and unaffected by Main theme updates. Typically, a child theme is used for the following customizations.
- To add JavaScript, CSS and fonts
- To add Less styles to the style library
- To override templates files
- To add builder elements to the element library
- To extend YOOtheme Pro with custom PHP code
Steps
To create a WordPress child theme, open the WordPress theme directory wp-content/themes
and create a new folder yootheme-NAME
for the child theme. The suffix is the name of the child theme, for example yootheme-mytheme
.
Next, create a style.css
file and add a header comment with information about the child theme at the very top of the file.
/*
Theme Name: YOOtheme MyTheme
Template: yootheme
Author: John Doe
Description: YOOtheme Child Theme
Version: 1.0.0
Text Domain: yootheme-mytheme
*/
Click here to download zip file
WordPress requires a unique theme name, and the Template parameter has to be set to yootheme
to define that the child theme has YOOtheme Pro as parent theme.
Once the stylesheet file is created, the child theme can be activated in the WordPress theme administration. Follow the WordPress child theme documentation for more information.
Important A child theme in WordPress has its own settings which are independent of the parent theme. When activating the child theme for the first time, all settings from the parent theme are copied and applied to the child theme. This also includes the menu settings and widget assignments.