What is a WordPress child theme and why is it important to use them?

What is a WordPress child theme and why is it important to use them?

If you have a website made with WordPress or you are developing it right now it is very important that you know what a child theme is and why it is interesting to use them in any web project.

What is a child theme?

If you are a WordPress user you will already know that the theme, theme or template is the set of files that determines the external organization and look of your website: colors, distribution of elements, typographies, navigation, location of widgets, structure of pages, etc..

A child theme is a theme developed from a parent theme, which inherits its basic functionality. Although the child theme collects most of the features of its parent theme, it is a theme that is not updated directly. When you work with a child theme on your website, both the parent theme and the child are installed, but only the parent is updated.

What is a child theme for?

When you develop a web page with WordPress, even if you have chosen a wonderful theme with all the features you were looking for, it is possible that for different reasons you end up wanting or needing to modify the theme code to make some changes, such as for example:

Small modifications in the css of your theme to customize its appearance.
Introduce a piece of code that adds some functionality.
Add some code needed to work with an external application…

But if you modify or add this code within your theme files, you will find that you can no longer update it, because if you do, the changes will be lost. This is a very common problem that many people I work with encounter. At the time they hired the design of their website and the designer modified the code of the template making it impossible for them to update absolutely anything on the software of the web without generating incompatibilities and losing everything that had been modified. And you already know that not updating the software of any web page implies very important risks since it opens a great amount of vulnerabilities exploitable by hackers.

But if from the first moment of the creation of your website, you start working with a child theme, anticipating that it is very probable that in the long run it will be necessary to touch the code of the theme, this problem disappears. It is always advisable to work with a child theme because it is there that code modifications are made while the theme that is updated is the parent theme. This allows you to keep any changes you’ve made and to keep all the software (theme, plugins, etc.) updated and up to date. The result is a fully customizable web but healthy and safe.

Keep in mind that even if today you firmly believe that what you need is a super simple web and that you don’t need to alter the code of your web, it is very probable that with time you will need to do it as your business grows and changes and your needs change.

How do I create a child theme from a WordPress theme?

Actually the process is very simple, although you need to be able to access your web files by ftp or the file manager made available by your hosting provider.

The installation of your web with all the files that compose it will be in the folder public.html. The files corresponding to the themes are inside the folder wp-content and inside it in the folder themes. When you open the theme folder you will find that each theme has its own folder named with the name of the theme.

The first thing you have to do is create a new folder where the child theme will be. It is very important that the names with the name of the parent theme followed by child. For example, if I am going to make a child theme from the Twenty fourteen theme, I will call this twenty-fourteen-child folder.

In this folder we will only leave a copy of the files that we want to modify, which are the ones that we will modify directly in the child theme, not affecting the parent theme at all and being able to update in the future normally.

Leave a Reply

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