WordPress - Child theme
⚠️ This article was created for developers!
To be able to follow the steps, you're required to have coding knowledge. If you're not a developer and can't achieve what you're looking for, consider hiring a developer.
Make sure to carefully follow the tutorial and write correct code. We're unable to provide help with custom coding, or the possible issues that are happening because of them.
If you don't want your changes to be overwritten by an update of your theme, or you just don't want to change the theme's files, then you could create a child theme, and put the slider's shortcode, or your other modifications in there instead.
Here is how you can do it:
Go to this folder:
folder with any name:
- Create a style.css file in it, and put this code into the file, where the [parent theme folder name] should be replaced with the folder's name of the parent theme, for example with twentyfifteen if you want to create a child theme for the Twenty Fifteen theme.
/* Theme Name: Child theme's name Template: [parent theme folder name] */ @import url('../[parent theme folder name]/style.css');
Sometimes the @import line is not necessary. After step 4. you can take a test, whether or not your website looks fine without it.
- Now you can activate this theme from your backend.
- Copy the files, you want to modify from your parent theme, and do the modifications. These files will load instead of the parent theme's files, when this theme is activated, and all the other files will come from the parent.
It is based on your parent theme's code, if there are limitations about which files can load from the child theme.
- If you create a functions.php file, its PHP codes won't overwrite the parent theme's functions.php file, but they will be just added to it as extra codes.