What is a WordPress Child Theme?
Child Themes To The RescueThis is where concept of Child Themes kick in. Let’s forget about WordPress for a moment. Let’s talk about parents and children. What do you know about children? Being a child, I am bound to get a few characteristics of my parents, but there will also be habits that are pretty unique. Which makes total sense. A child can have some or all traits of their parents with added unique traits of her own. The concept of Child Themes is based on this fact, and during this entire series I will try to cover all the major aspects of WordPress and Child Themes. So, let’s begin with the first article, which serve as an introduction to child themes. Towards the end of this article, I’ll discuss some of the differences between a parent and a child theme.
Child Themes in WordPressNormally, all the created WordPress themes are the base themes, or you call them Parent themes. Parent themes bear all the functionality and features which may or may not be inherited by a child theme. Let me explain this concept with a simple example. Imagine that you are a chemist and you are running some experiment. You prepared a solution and you aim to test it further with different types of emulsions. Now, instead of using the entire solution all at once, you divide it into two or three equal parts with each part behaving as a parent. Now if you perform an experiment and it didn’t get the desired results, you will still have a duplicate parent which can be later used for another test. However, if you performed the test on the entire solution, then in case of failure, you may lose the original product (i.e. your parent theme). So, every time you experiment, you have the original parent which has all the features you need. These features can be used as a base while you can add a few unique features in the child which is what a child theme does. Still with me?
The Official DefinitionAccording to the WordPress codex:
A child theme is a theme that inherits the functionality and styling of another theme, called the parent theme. Child themes are the recommended way of modifying an existing theme.So basically, any theme can behave as a parent theme if it offers the ability of creating a child theme. Now, back to the situation we discussed earlier. If a child inherits features from a parent then what will happen in a case where the parent theme undergoes an update? The answer is simple: only your parent theme will change, while your modifications will stay the same in its Child Theme. So, if you want to keep up with your modifications and still enjoy the latest code base from your theme’s author, all you need to do is create a child theme instead of using the parent theme. We will discuss multiple methods to create a WP child theme in upcoming articles of this series.
Differences between Parent & Child ThemesNow let’s look at some of the differences between parent and child themes.
- A child theme is related only to its parent theme. Which means that in terms of relevance no other theme bears connection with the child theme.
- A child theme is dependent upon the parent theme. To make sure that your child works well, you need to install both the parent & the child theme and then activate the later.
- Parent themes can exist as an independent unit since they are not dependant on any other theme.
- Updates in the parent theme do not affect your modifications in the child theme.
ConclusionSo now you know a little about child themes. In the next post, we will discuss the advantages and disadvantages of using a Child Theme in WordPress. I’d love to hear your thoughts about this series, so leave me a comment below if you have any questions or requests.
Ahmad Awais is a Full Stack WordPress Developer, WP Core Contributor, Front-end Fanatic and a Designer by night. He loves to create optimized but advanced workflows to produce cool pieces of Open Source software. Follow Ahmad at Twitter or subscribe to his blog.
Products Seen In This Post:
WPTiE | (Ahmad Awais & Maedah Batool) 🙌 Two WordPressers fell in love and got married. They're bold enough to call themselves The WordPress Couple. 🎩→ Ahmad Awais (Full Stack WP Dev / WP Core Contributor) and 🎩→ Maedah Batool (WordPress Journalist / WP Core Contributor).View More Posts