For those looking to make programmatic changes to their site, or add CSS styling it’s strongly encouraged to not make any such changes directly into your active WordPress theme. Make changes to your active theme directly can result in the following:
- Changes being overwritten with any theme updates
- Your website going down if you happen to misplace code
- Things not working as expected
Rather than making changes directly to your theme a child theme should be created.
What is a child theme, why should I create one?
A child theme in simple terms is a WordPress theme which is linked to a another theme, known as the parent theme. A child theme inherits all the parent themes layout, templates and styling.
If you copy any of the parent themes files into a child theme you can safely make changes to the files within the child theme. Those changes will overwrite your parent themes files.
Using a child them allows you to make theme modifications, while keeping your parent theme intact. Parent theme updates won’t result in loosing any modifications to a child theme.
You’ll find the basics on how to create a child theme below.
How to create a child theme manually
If you’re looking to create a child theme there are multiple methods to
Creating a child theme using a plugin, and selecting files to overwrite
There are many good plugins that exist which make creating a child theme easy. We’re going to use Child Theme Configurator for this demo, with basic configurations. It’s the most common plugin for creating child themes.
- Download, install and activate the Child Theme Configurator plugin
- Navigate to “Tools” and then “Child Themes”
- For the first step within this plugin (Select an action) choose “Create a new Child Theme”
- In step 2 (Select a Parent Theme) choose the parent theme you plan to use and press the “Analyze” button
- Skip straight to step 9 within the plugin and press the “Create New Child Theme” button. Before doing so you can change any of the configurations if you prefer.
- Your child theme is now configured. Next is to add any specific theme file to overwrite, and add that to your child theme. From the same screen child on the “Files” tab