Last time we were talking about themes, places to search for them, and all the aspects of how to pick a nice one. We had also mentioned an important thing called child themes which will extremely helpful for any kind of a WordPress website. So that you obviously need to know what are they, how do they work, why do you need them and what for.

As we have written before, child themes’ main purpose is to extend the functionality of the WordPress themes. In that case, we call the main theme a Parent Theme, and the one inheriting the features — a Child Theme.

Years ago there was no way to customize the theme and preserve the possibility to update it. You had to choose between no updates and losing all your custom styles and stuff. So that is why the concept of Child themes appeared, to make it possible to modify the theme without making any interruption into the source code itself.

Child themes can be created on the basis of any theme on the market. But not every theme is a good starting point for creating a child theme. As it been said, a Child theme inherits everything from its parent. That means the quality of the code, the quantity, and quality of functionality of both themes are interdependent. That is why it is not recommended to create child themes on the basis of free themes or themes without author support. Keep in mind that child themes do not fix the problem of its donor. So that, check our previous material to figure out which key factors define a good theme.

How does it work?

A child theme is a set of style.css and functions.php files that are placed in a separate directory from a parent theme. Those are the core files that allow a theme to function properly, but any other file types can also be created. Editing a proper file, you can add any script or layout parameter that doesn’t exist in a parent theme.

When you are loading a certain type of page on the website, WordPress loads the template files according to the hierarchy. That means if you are trying to load a homepage, WordPress will search for header and footer templates. Firstly it will try to load a child theme template of a header. If you haven’t done any customization to the header, WordPress will go to the parent theme template directory instead, and load every element missing. So that, child theme templates always go primarily, then everything else.

In case of updating your theme, all the customization files of a child theme stay separate, which allows you to update files of a theme without any risk to lose settings.

What are the alternatives today?

To be frank, there are still no objective reasons not to use a child theme. It helps to solve the tasks of styling and customizing a theme without any problems. Designers and developers use child themes to boost the speed of development of a website with the help of a child theme because of its simplicity. All you need to create a child theme is to add one line in the new styles.css header, to define templates that it will use. Additionally, child themes may have templates unavailable for a parent theme. Beginner users can simply install a plugin called Childify Me, that will create a child theme for you, requiring no code or file usage.

Adding new styles and functions for a theme is possible within creating a whole plugin, for example, a custom CSS plugin. Still, it requires a lot of skill and time, which doesn’t allow to consider the variant equal to a child theme. So that the answer is that, there is still no alternative to using child themes today.

In some cases, a child theme may override all the files of the parent theme, becoming a custom theme itself. But, the case occurs if a starting theme has too many defects or desired elements to be changed.

Pros and cons of using a child theme

Pros

To the obvious pros of using child themes, we can pick out the following:

  1. Theme updates. As mentioned before, probably it is the main feature making child themes so important. If you want to preserve your custom styles and functionality after the update, create a child theme for yourself. It is possible to live without theme updates, but it turns out to be a poison pill.
  2. Fail-preventer. In a usual theme, all the coding issues may totally break your website. WordPress isn’t capable to fix human factor mistakes in the code but for child themes. Because of making all the changes in separate directories, WordPress is able to fill up omissions in the code of a child theme with the code from a parent theme.
  3. Code-clarity. The child theme is a bunch of custom styles and functions that you can find any moment in a specific directory. So that helps to keep everything organized and find all the necessary changes pretty fast. It also helps to keep a parent theme code clean.

Cons

Ironic as it might sound, but pros are the cons. Child themes are interdependent with the quality of every constituent of a parent theme. That means, all the problems that your current theme has, will be reflected in your child theme also unless you fix them and override the parent theme this way.

May I use my child theme with another parent theme?

As every specific child theme is created on the basis of a parent theme, that has its unique features and architecture, it is not possible to use the same child theme with custom templates twice. You will have to create a new child theme and customize everything from the scratch.

Why should I use a child theme, not just a good theme from the start?

Many website owners are trying to find a theme or a theme framework to fit all their needs in any situation. A theme is a good basis for a website when it is clean and clearly optimized with a “necessary” pack of functionality and options. If you are downloading a theme, that is more than 5MB in a zip file, it is piled up with the functionality you won’t probably use, which will result in various bugs and slow work. Choosing a parent theme, less is more. Find a theme with an optimal pack of options, which you will be able to extend with the help of a child theme.

To make everything pretty, child themes are used to accomplish the ideas that were not embodied in a parent theme at the beginning. They also help to correct designs or change it fully, creating a totally new look for an initial theme.

Summing up

If you want to create a smooth running website with the number of unique features, the child theme is a tool to help you. Save time, keep your code clean and organized, customize your themes’ design, functionality and run a website without any troubles!
Photos by Denis Bayer and Markus Spiske on Unsplash!