Child theme is very important if you want to make changes to your theme. Child theme enables you to modify and customize the theme without having to touch the parent theme. So, if the parent theme gets updated, you won’t lose any customizations made for the website.
You literally only need one file to create a child theme, and that’s style.css
To create a child theme, follow the following steps:
- Navigate and create a new folder on your themes directory through FTP. The directory is located at wp-content/themes folder.
- Once there, create a folder. You can name it anything you like, but the best practice is to write the name of parent theme and then include ‘-child’. That way, your folder will make sense and look neat. For example: twentythirteen-child for twentythirteen theme.
- Now you need to create a file
style.css
inside the child theme. - Open
style.css
in your text editor and paste the following code./* Theme Name: Twenty Thirteen Child Theme Description: Child theme for Twenty Thirteen Author: DevotePress Author URI: http://DevotePress.com Template: twentythirteen */ @import url("../twentythirteen/style.css");
Theme Name -> The name for your child theme.
Description -> A short description about your child theme.
Author -> Your name.
Author URI -> Website URI of the author.
Template -> The parent themeThe most important part of child theme is the following line:
@import url("../twentythirteen/style.css");
This line imports
style.css
from the parent theme, and overrides changes made to the child theme’sstyle.css
. without it, our child theme will not work. - Save the file and transfer it to your server via FTP.
- Check your website’s Dashborad -> Appearance -> Themes. You should now see a Twenty Thirteen Child Theme listed as an available theme. Activate it.
- View your site and you should now see your child theme working it’s magic.