Child themes FAQ
A WordPress child theme is a theme that inherits the functionality and styling of another theme, known as the parent theme. It’s basically a duplicate of the parent theme with a few key differences.
When a child theme is activated, it will use the styles and functions of the parent theme, and then override them with any styles and functions it has defined itself.
Also, the parent theme can be updated without fear of losing customizations.
Using a child theme has two advantages for WordPress developers:
Safety: Modifying the parent theme directly can lead to issues when the parent theme is updated. With a child theme, you can make changes to the theme without modifying the parent theme, so your changes won’t be overwritten when the parent theme is updated.
Customizability: Child themes are a great way to customize a theme without having to create a new theme from scratch. A child theme allows you to customize your site while still being able to take advantage of the existing functionality and styling of the parent theme.
A child theme includes several basic files and you can add more to fit your needs.
First, it has its own stylesheet (
style.css), which is used to override the styles of the parent theme, so you can make changes to the design of your site without modifying the parent theme.
Second, it has its own
functions.php file, which is used to add new features or override existing ones from the parent theme.
Finally, you can add template files to your WordPress child theme. If a template file exists in the child theme (like
single.php), it will be used instead of the corresponding template file in the parent theme. This way, you can customize the layout of your site without altering the parent theme.
A child theme can also contain a
screenshot.png file of 1200 × 900 pixels. It allows to better visualize it in the WordPress administration.
Making a child theme from scratch can be a little annoying if you’re not used to the process.
You’ll have to create a folder with the needed files (at least
style.css) then add appropriate content in them (information about the child theme and enqueuing the parent theme stylesheet).
You can learn more by checking the documentation on WordPress.org or using WPTurbo’s child theme generator.
Once created, compress the folder to make a zip file so you can install it on your WordPress website.
Regarding installation, a WordPress child theme has no difference with regular themes.
Go to Appearance > Themes in your WordPress admin area, click Add new, then Upload theme. Upload your newly created child theme zip file and click the Activate button next to its name.
That’s it, you can now start customizing your child theme by adding new styles and functions, or by modifying template files. Remember that, any changes you make to the child theme will not affect the parent theme and your customization will remain safe even if the parent theme gets updates.
It depends but it’s less and less likely. Today, most WordPress themes has a custom CSS field in the customizer area. If you just need to edit styles, there’s no need of a child theme.
To add new features, you can create a functionnality plugin. This way, you won’t have to deal with a child theme.
However, the only case where you absolutely have to use a child theme is when you have to customize template files (except if you use a block theme, because templates can be updated in the site editor).