What is a child theme and why should you create one? The simple answer is that you probably want to some make changes to your website but you don’t want to lose the changes you applied when you update the theme.
Creating a child theme inherits all the code from the parent theme which allows you to modify any file and keep these changes without getting overwritten when the theme gets updated.
You will need to have an access to your site files, this is done via an FTP client ( use FileZilla it is free!)
You can create a child theme in only 3 simple steps:
- Create a child theme directory, and with that I mean create a folder inside
wp-content -> themes. By convention the folder name will be your child theme name. For example if you creating a child theme for the Twenty Sixteen theme, the folder name would be “twentysixteen-child”.
- Create a file in your child theme directory and name it
style.cssand add the following code into it:
Templateis the folder name/text domain of your parent theme.
- Create another file in your child theme directory and name it
functions.phpand add the following code into it:
'parent-style'is the same
$handleused in the parent theme when it registers its stylesheet.
Now you can make changes to any of your theme files by copying and pasting it to the child theme directory. Open the file you copied, apply your modifications and they will be kept safe!
Download a pre-made and ready-to-use Child Theme?
If you don’t want to do that stuff manually, we have created a very simple and ready-to-use child theme just download it, open
style.css file and change
parent-theme-directory-name to your parent theme’s directory name.