Making changes to themes can cause several problems. On the one hand, errors can completely break the website (especially if no backup is available). On the other hand, changes made directly to a theme may be overwritten and therefore lost when the theme is updated.
To avoid these problems from the outset, you can create what is known as a child theme. Child themes have two advantages:
1. Since the original files are not modified, they can be used as a backup at any time.
2. When the parent theme is updated, our changes in the child theme are not overwritten.
To create a child theme, you need to create a new folder under
wp-content\themes
If your parent folder is called, for example, Your_Project, name the child folder Your_Project_Child. In the new folder, create a style.css file with the following content:
/*
Theme Name:
Description:
Author:
Author URI:
Template:
Version: 1.0
*/
Fill in the corresponding information and save the file.
Next, create a functions.php file in your child theme folder and add the following as a placeholder:
<?php
/**
* Your_Project-child-theme functions and definitions
*
*/
?>
Save the file again. For a better overview, you can place a screenshot in your child theme folder, which will then be used to represent your child theme in the backend.
As the final step, go to the WordPress backend and select
Appearance --> Themes
and activate the child theme.
