What is a Child Theme and Why Use One?

WordPress comes with a plethora of themes. These themes include files that control the overall structure and functionality of your website.

You can customize these themes to match your brand and style. However, if you ever update the theme, all your customizations will be lost with it. That is, unless you’ve created a child theme for the original (or parent) theme.

So, What Exactly is a Child Theme?

A child theme is a WordPress theme that is patterned after the parent theme. In it, you can include special styles, features or even functions that you want to retain. These customizations are not affected by the update unless you modify the child theme itself.

Some parent themes come with a child theme, but others do not. It’s vital not to include your customizations within the parent theme, but to the child theme instead.

Why Use A Child Theme?

A child theme is essential to any WordPress site that’s been customized, and it can save you time and headache. Without it, all your hard work will be overwritten during/after an update.

At Precision Web Crafting, we use child themes whenever we apply customizations to a WordPress theme.

How to Create a Child Theme

  1. Create a folder for the child theme you wish to create
  2. Open any text editor and paste the following content inside:
    /*
    Theme Name: Twenty Ten Child
    Template: twentyten
    */@import url(“../twentyten/style.css”);

    /* =Theme customization starts here
    ————————————————————– */

  3. Replace Twenty Ten with the name of the parent theme, where it says:
    Theme Name: Twenty Ten Child
  4. Replace twentyten with the name of the parent theme, where it says:
    Template: twentyten
  5. Replace twentyten with the name of the exact folder for the parent theme, where it says:
    @import url(“../twentyten/style.css”);
  6. Save the file in the child theme folder and name it style.css
  7. Use an FTP client (or the file manager on your hosting account) to upload the theme and folder to your WordPress folder under: wp-content > themes
  8. Optional… If you would like display a snapshot of the theme in WordPress (similar to the parent theme when you activate it), copy the screenshot.png file from the parent theme’s folder under wp-content > themes to the child theme’s folder.
  9. Log into your WordPress dashboard and navigate to Appearance > Themes
  10. Locate the child theme you created and click Activate. A snapshot of the theme will display here if you copied the screenshot.png file to the child theme’s folder in Step 8.
  11. Navigate to Appearance > Editor. You will be directed to the style.css file for the activated child theme.
  12. Add your customizations below:
    /* =Theme customization starts here
    ————————————————————– */

Adding Functions to a Child Theme

If you have any special functions you’ll like to add or customize, you can also make a functions.php and place it in the child theme’s folder. While the child theme’s functions.php does not override the parent theme’s functions.php, you can add your own customizations to it. This will allow you to retain any customizations you’ve made to the functions.php during a theme update.

Share