How to Create Child Theme in WordPress the Right Way

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:

  1. Navigate and create a new folder on your themes directory through FTP. The directory is located at wp-content/themes folder.
  2. wp-contents/themes

  3. 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.
  4. twentythirteen-child

  5. Now you need to create a file style.css inside the child theme.
  6. 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 theme

    The 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’s style.css. without it, our child theme will not work.

  7. Save the file and transfer it to your server via FTP.
  8. Check your website’s Dashborad -> Appearance -> Themes. You should now see a Twenty Thirteen Child Theme listed as an available theme. Activate it.
  9. View your site and you should now see your child theme working it’s magic.

Leave a Reply

Your email address will not be published. Required fields are marked *