Customizing your Theme Using a Child Theme

Last updated December 18, 2018 « Knowledge Base

Abstract: Always create a Child Theme if using a theme purchased from a marketplace or built by someone other than yourself.

One of the biggest benefits to using WordPress is the ability to customize plugins and themes to meet your needs. There are some very important best practices that should be considered when making customizations to your existing website to accommodate the changes you wish to make.

Child Themes

Many websites use themes built by third parties. These themes occasionally receive updates that are visible in your WordPress Dashboard. It is important to keep your theme up to date for a number of reasons, primarily security updates, compatibility updates, and performance enhancements.

When a theme receives an update, any and all customizations you have applied directly to that theme (e.g. directly edited files in the theme directory) will be overwritten and lost. This does not necessarily apply to customizations you have made in the WordPress Dashboard, but the actual files of the theme itself.

To avoid losing customizations you have put in place, WordPress has implemented a concept of Child Themes. Child Themes are themes you can write and customize that run on top of a parent theme. In this case the parent theme would be the third party theme that might receive an update.

Child Themes are not automatically updated, but instead utilize all of the functionality of their parent theme, with the unique ability to customize and override functionality of the parent theme. The parent theme receives updates through the WordPress Dashboard, leaving your Child Theme (and all of your customizations) untouched and fully in tact.

At a minimum (and likely all you’ll need) a Child Theme is a folder in your themes directory with two (or more) files that match the structure of any WordPress theme:

  • style.css
  • functions.php

The style.css should contain a standard WordPress Theme definition comment block with one unique difference when compared to a parent theme. You must add a line to the Theme definition comment block to define the parent theme, something like:

Template: twentyfifteen

Where twentyfifteen is the folder name of the parent theme. This line tells WordPress that we are working with a Child Theme and to inherit all that comes with it. Please see the Child Theme documentation for more info.

With your Child Theme active, you can make any and all customizations to the functions.php in your Child Theme without worrying about losing them when the parent theme receives an update.

Fix Search on Your Site. No Coding Required!

Now you can utilize all of the content that's gone unrecognized by native WordPress search instantly with SearchWP

Get SearchWP