Quoting WordPress documentation (Child Themes), a “child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to modify, or add to, the functionality of that parent theme.”
The main advantage in making a child-theme, instead of just modify an existing one, is the future possibility to use the parent-theme updates without loosing your own personalizations.
Let’s suppose we have a theme and we want to use a different icon set with different dimensions, normally we will modify theme files, but what if after a couple of weeks (or worste month), a new version of the theme, with very interesting features, is released?!
- Case A: we don’t remember we’ve done some modifications and we update… personalizations are gone!!
- Case B: we modify again every single theme file.
- Case C: we like new features, we don’t like to modify the theme again, we don’t update
- And so on…
Now let’s assume we do made a child-theme; as soon as a new version of the parent-theme is released we just need to check that everything is working, and if not, we will know exactly where to set it (a child-theme is made only by the files we need, see pictures beside).
The making of a basic child-theme is quite simple: create a new folder in themes direcory wp-content/themes/ (e.g. fastfood-child), inside it put a style.css with the following header:
/* Theme Name: Fastfood Child Description: Fastfood child theme Author: tbcrew Template: fastfood */ @import url("../fastfood/style.css");
- Template is the folder name, not the parent-theme name (WP official documentation said is the parent-theme name, but we have notice that in some hosts can cause problems).
- @import url(“../fastfood/style.css”); has to point to parent-theme’s style.css
Before making a child theme is very important to plan exactly wich parts of the parent-theme we want to change (copy all parent-theme files won’t have any sense), and that, when a child theme is done, it’ll rule on the parent-theme:
- if we want to change something in the style, just write the rules into child-theme’s style.css
- if we want to make another footer, we’ll copy parent-theme’s footer.php into child-theme directory and go on with the changes
Once a child-theme is done, it could be activated as a normal theme in Dashboard -> Themes
N.B. Parent-theme’s folder and all his files must not be removed
P.S. If you’re looking for a faster solution, I may suggest One-Click Child Theme plugin for WordPress; I didn’t try it, but it looks good.
The last, but not the least, important aspect of a child-theme: is faster to make it than release a new version of the theme. And that’s why we “abuse” of it to satisfy the many requests we have .
Previously made child-themes will be released soon .