WordPress Child Theme Basics – Why They Should Always Be Used

WordPress Child Theme Basics - How to User Child ThemesIn this article we’ll cover the basics of a WordPress child theme. Also covered is why using a child theme is so important if you want to customize the theme’s CSS or PHP files.

One of the beauties of WordPress is the abundance of WordPress themes which shave-off several hours of development time. These themes as good as they can be usually require a little bit of tweaking. The problem is that modifying a theme’s CSS or PHP files even slightly prevents you from updating it to a newer version in the future. If you do try to update your theme to a newer version, all of your changes will be overwritten and lost.

A WordPress child theme solves this problem. WordPress child themes are separate themes that rely on a parent theme for most of their functionality. If you are using a child theme, WordPress will first check your child theme to see if a specific functionality already exists. If it doesn’t exist, it will use the parent theme. This allows you to only add things you wish to change to your WordPress child theme and letting the parent theme handle the bulk of the functionality.

Since WordPress child themes fall back on parent themes, your child theme is essentially a changeset to an existing parent theme. This can result in extensive changes even though the child theme may only have a couple of files.

To create a WordPress child theme for your theme, do the following steps:

For this example, I will be creating a child theme for the Twenty Sixteen default theme.

  1. First, go to your theme directory and create a folder for your new theme. You may name it anything you’d like.
  2. The next step is to create a stylesheet file. This must be named style.css. Copy and paste the following code into the file you’ve just created:

Theme Name:   Twenty Sixteen Child
Theme URI:    http://yourwebsite.com/twentysixteen-child/
Description:  XYZ Website based on Twenty Sixteen
Author:       Level One
Author URI:   http://levelonewebdesign.com
Template:     twentysixteen
Version:      1.0.1

The two important items in the code above are the lines starting with Theme Name and Template. The theme name tells WordPress what the name of your child theme is, and this is the name displayed in the theme selector. The template tells WordPress which theme is the parent theme.

WordPress child theme, WordPress for Beginners, WordPress Setup, WordPress tutorials
Previous Post
Modifying the wp-config.php File
Next Post
Must-Use WordPress Security Plugin – Wordfence

Related Posts

You must be logged in to post a comment.