wordpress child theme

What is a WordPress Child Theme

One of the first tasks when setting up a new WordPress website before even getting to the question of What is a WordPress Child Theme is to choose a main theme, this may be anything from an exciting or dreaded job depending upon your own experiences. As far as I was concerned for many years it went between being a necessary evil at best to a job I hated at worst.

I was never comfortable with the route that so many people seem to take, i.e. Theme Forest, even in my early days with little WordPress experience I just didn’t trust them and that was often borne out with bad experiences further down the line when it came to managing and updating themes. Which brings us to the subject of Child Themes, child themes were introduced by the WordPress community (WordPress is open source and developed with input from the community).

In the early days before Child Themes an update to your WordPress theme would result in you losing any custom styling and changes that you had made to the theme.

This could create serious stress when, in the event of an exploit the theme provider might inform you of an update and that you need to update your own theme ASAP. What to do? Loose all of your custom styles if you update or run the risk of your site getting hacked if you don’t?

What is a WordPress Child Theme in Relation to the Parent Theme?

The WordPress community of developers introduced a solution – the concept of parent theme and child theme was borne. The child theme in WordPress inherits all of the functionality, features and code of the parent theme without touching the parent theme at all. Now, with a child theme installed and activated you could change the styling of the parent theme while still being able to update the parent theme.

What is a WordPress Child Theme – The Answer from WordPress

As with most WordPress questions the answer can be found on the Codex:

  • If you modify a theme directly and it is updated, then your modifications may be lost. By using a child theme you will ensure that your modifications are preserved.
  • Using a child theme can speed up development time.
  • Using a child theme is a great way to learn about WordPress theme development.

Source: https://codex.wordpress.org/Child_Themes 

As great a move as this was the majority of WordPress websites still didn’t (and don’t) take make use of the advantages to be gained. Why not? Mostly one suspects through the ignorance of just not being aware or otherwise a head in the sand approach as a result of the fear of all things technical.

For all that the process of creating a Child Theme is relatively straightforward.

Creating a WordPress Child Theme

This a a basic walk through of creating a child theme. Firstly create a new folder for your child theme, name it something like /wpstream-child/ Within your new theme folder, create a file called style.css and add the information as below. The theme Name, URI, Description and Author are your choice.

Theme Name: WPStream Child Theme
Theme URI: https://www.i-netco.co.uk/wpstream/
Description: WP Stream Child Theme
Author: i-Netco
Author URI: https://www.i-netco.co.uk
Template: WPStream
Version: 1.0.0

@import url(“../WPStream/style.css”);

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

The “Template:” and @import sections are important here as they identify the parent theme that imports the CSS from the parent or orginal. You must make sure the path to your parent theme’s css file is correct, and that the “Template:” parameter correctly identifies the name of the parent theme and in the correct case. The folder of our parent theme is “WPStream” and the @import URL reflects this.

How to Activate a WordPress Child Theme

After you have created your child theme folder and style.css file, you will Zip and upload the folder and activate the new child theme in WordPress admin Appearances > Themes as you would any theme, the Parent theme must be uploaded to the themes section before activating the Child Theme.

Banner - 728 x 90

Alternatives to Creating Your Own WordPress Child Theme

There are alternatives available should you prefer not to go through the process outlined here, there are plugins available to do the job for you although the last time I checked the choice was limited. On the other hand, if like me you work with the fantastic Beaver Builder framework (the banner links to my affiliate account) you will have this taken care of, Beaver Builder provide their subscribers with a ready made Child Theme along with the parent Theme, all you need to do is upload both, activate the Child Theme and Bob’s your uncle!