Since theme updates might remove any customization, creating a child theme could prevent it. Any customization could be applied through a child theme without affecting the functionality of the parent theme [1].
Many comprehensive tutorials are out there, thus creating a WordPress child theme is an easy task. However, in some cases, it is frustrating if any issues occur just because of trivial matters. Here, we will discuss several common issues in creating a WordPress child theme, and how to fix them.
Before trying the solution, make sure that your WordPress version is up to date
A parent theme is required
The child theme only adds customization to the parent theme. Thus, the parent theme must remain installed and can be left inactive.
Child theme can’t detect its parent
In some cases, even though the parent theme is installed, a child theme is considered a broken theme, as illustrated in Fig. 1.
The typical issue would be:
The parent theme is missing. Please install the "ThemeName" parent theme.
Apparently, WordPress looks at the parent-theme directory name as a reference, and is case-sensitive [1]. For example, the GeneratePress directory name is “generatepress”, which uses lowercase, as illustrated in Fig. 2.
Therefore, if you encounter this issue, you may want to prior check the directory name of the parent theme. Then, in the style.css
of a child theme, the Template
declarations should refer to the directory name of the parent theme. For example, the style.css
of the GeneratePress child theme should be as follows:
/*
Template: generatepress
Theme Name: GeneratePress Child
Description: GeneratePress Child Theme
*/
References
- [1]WordPress.org, “Child Themes,” WordPress: Developer Resources. https://developer.wordpress.org/themes/advanced-topics/child-themes/ (accessed Sep. 17, 2022).