WordPress Child Themes

This week I gave a talk on utilizing child themes in WordPress.  When designing a website within WordPress you typically start off with a theme. You might either make changes under the customize section or within the style editor. After spending some time with this you get your theme to where you want it, and everything is great. One of the downfalls with WordPress is updates. Updates usually break something on your website. When you update a theme, the customizations you apply in the style editor can be undone, this leaves a big problem.

So how do you solve this problem? You implement a child theme within your WordPress. A child theme takes your current theme as a starting point and lets you add your own customizations on top of it. So, say you have the 2014 WordPress theme, you create a child theme called ‘My 2014’. In the ‘My 2014’ there will be a @import at the top of the CSS Style sheet. This @import will import all the configurations from the parent theme 2014. Anything written below it overrides the parent theme, while inheriting all the parent theme settings, unless overrode.

There are ways you can do this manually by creating a directory and setting up the needed files yourself. I found it is easier and more effective to use a plugin. The plugin I found that works great is called ‘Child Theme Wizard’. In the tools section of this plugin you will be able to create a child theme, once created you can activate it like any theme under your appearance tab. Now once you have your child theme in place, deactivate the plugin. The less plugins active on your WordPress site the better.

A child theme has three files, first is the CSS stylesheet, then you have a Right to Left CSS file, for right to left languages. You also have a PNG file for the thumbnail of the theme. One major tip when working with your child theme, is you need to know your parent themes CSS Stylesheet very well. This will make it easier to implement changes.

In the next couple weeks, I will be posting on the best practices for child themes.

Resources:

Link to my slides: https://docs.google.com/presentation/d/19yNqLUm_GCzPvGhhBnXWX55lgM-IZubJS-jBkRXqhJY/edit?usp=sharing

Leave a Reply

Your email address will not be published. Required fields are marked *