A child theme is a sub-theme that inherits all the functionality and style of the main theme, also called the parent theme.

Child themes are a safe way to modify a WordPress theme without directly altering it. When the parent theme is updated, changes made to the child theme will be preserved and also applied to the updated version.

Sometimes the child theme comes with the theme, but this is not always the case. You will have to create it manually.

In order to create a child theme, you must first create the child theme directory, which will be placed in wp-content/themes/. It is recommended to add “-child” at the end of the child theme directory name.

The child theme directory should contain at least:

  • One file style.css which will host the additional CSS code.
  • One file functions.php where you can add configurations on the theme.

We will also duplicate in the child theme all the files of the parent theme’s code we want to modify.

Important note: This will only work with the basic files of a WordPress theme (also called, template hierarchy files). Files added by the developer will not always be editable in the child theme.

In order to take changes into account, the child theme must be enabled. WordPress will then prioritize the files in the child theme instead of the default parent file.

To learn more about creating a child theme, you can read this article: Creating a WordPress child theme: is it really necessary in 2021?

To help you, here is the WPMarmite child theme generator.