WordPress Child Themes: What Are They, Why Use One & How To Set One Up

Themes are fundamental to WordPress. 

New to WP? 

If so, read on. We’re going to dive into themes and child themes. 

In this article, we will master:

  • What is a theme in WordPress?
  • What is a child theme in WordPress?
  • Reasons to use a child theme.
  • How to create a child theme.
  • Mistakes to avoid when creating a child theme.

 

What Is A Theme in WordPress?

A WordPress theme is a folder that contains web files loaded with both content and lines of codes. They instruct the browser what, where and how to display information. 

WordPress themes are what makes it so easy for non-developers to develop websites and critical for you to master if you are to learn how to use WordPress.

Technically a WordPress theme comprises template files, stylesheet files and media files. 

These determine the look and feel of your website. This includes typography, the layout of your pages, colour scheme etc. 

Themes are very user friendly, and most of them have drag and drop page builders. WordPress themes have inbuilt – What You See Is What You Get (WYSIWYG) editors.

Once you have installed WordPress, you will be able to choose from a number of free default WordPress themes which are currently Twenty Nineteen, Twenty Twenty and Twenty Twenty-One. 

 

 

WordPress also offers over 8,000 free themes to suit different types of website niches. They include eCommerce, blogs, informational websites, corporate, medical, not-for-profit, and so much more.

 

 

There are also purchase premium WordPress themes. These are often designed to work particularly well for certain types of business or offer specific functionality. 

There are a number of theme marketplaces that sell themes like Themeforest.

 

What Is A Child Theme In WordPress?

A WordPress child theme is a copy of the parent theme. It has the same code, functionality and appearance as a parent theme.

However, you can customize a child theme without actually touching the parent theme files. 

The changes will not override the parent theme files. It offers a fallback plan to your WordPress theme at any time.

A child theme prevents the site from breaking when the parent theme updates itself. This is because the updates only replace files in the parent and not the child theme.

For a child theme to work, it must have a style.css file and functions.php file. A style.css file maintains the appearance of the parent theme. The functions.php file then oversees all the theme functions.

The functions.php file enables you to customize your core theme files as desired, using PHP code.

Some WordPress themes come with child themes included. 

However, if your WordPress theme does not have a child theme, you can easily create one.

 

When Should I Use A Child Theme?

A child theme is suitable when you are making substantial changes to the parent theme. This would include things like editing the styling and layout to suit your preference.

The functions.php file in the child theme will ensure all is not lost when the parent theme update is available.

 

Advantages of Using A Child Theme

  1. You can create a child theme through your cPanel file manager and proceed to develop it in WordPress. The process is the same as setting up a parent theme.
  2. If you are developing several similar websites, it is far faster if you clone the child theme.
  3. A child theme avoids problems when customizing your theme. You will be working on a copy of the theme and not the parent theme and so can easily roll.

During child theme customization, the parent theme files remain intact. You can reinstate the theme to its default settings if need be.

 

Disadvantages of Using A Child Theme

  1. You will need to know how the parent theme works. Then, how the specific theme files work together to achieve their intended functions.
  2. Making lots of changes to a child theme will result in your site loading slowly. The child theme initially refers to the parent theme’s functionality and appearance before then loading. 
  3. You need to remember to update your parent theme to keep your site secure. Some people find this tricky as they are so focused on the child theme.  

 

How To Create A Custom Child Theme

Creating a child theme is relatively straightforward. 

All you need to do is create a child theme folder, style.css and function.php files. 

Here is a step-by-step guide on how you can do it.

Child Theme Configurator Plugin

You can customize your child theme using a child theme configurator plugin. Use the plugin to edit your child theme files.

How does it work? 

The child theme configurator records the location of all your stylesheet files. Then, it checks your child theme files and makes custom changes. It does this without interfering with the parent theme files. 

Next, the child theme configurator will enqueue the functions.php and style.css files. It will then enable you to create other child themes. These child themes will all link to the parent theme. Once done, the child themes will show in your WordPress theme directory.

 

5 Mistakes To Avoid When Creating A Child Theme

To create a child theme in the right way, avoid the following:

  1. Include spaces in the folder’s name. Instead, replace the spacing with hyphens.
  2. Use a different template name from the parent theme name when creating a style.css file. WordPress won’t know which theme the child theme should inherit from. 
  3. Not including the @import url link in the style.css file. The child theme will not import the parent theme styling appearance and functionality. 
  4. Using different case types when writing the template name. It’s important to note that the template name is case sensitive.
  5. Duplicating the complete functions.php file in your parent theme to your child theme. Doing this will make your site load twice, at the same time; that is, the child and parent themes. Instead, copy a snippet of the code as shown above.

 

Conclusion

WordPress child theme allows you to customize the parent theme with ease. It inherits all the functionality and appearance of a parent theme. A child theme makes it easier to customize the parent theme without touching the core files.

Create a child theme through the cPanel and include the style.css and function.php files. These two files will ensure the theme loads well.

Working on a child theme prevents losing any changes made when the parent theme updates.

Looking for something a little different? Check out our AutoCAD for architects guide here!

 

About Ben Richardson

Ben is a director of Acuity Training which he has been running for over 10 years.


He is a Natural Sciences graduate from the University of Cambridge and a qualified accountant with the ICAEW.


He previously worked as a venture capitalist and banker and so had extensive experience with Excel from building financial models before moving to learn SQL, Microsoft Power BI and other technologies more recently.