Why We use Child Theme in WordPress

why-we-use-child-theme-in-wordpress

Why do we use a child theme? After all, we could just edit the parent theme. It seems that at first glance it does not differ, because the result is the same.

Why do you still need a Child Theme?

Let’s look at a fairly common example: the web developer has made changes to the main theme, everything works well. But then after a while, there is a new version of the theme, which added new features and improved performance. The user updates the theme. The update is arranged in such a way that some old files are replaced with new ones. So you have almost 100% chance that your site will break or there will be some minor bugs. And also, there is no backup… And it turns out that the developer also did not save the backup or disappeared somewhere… And you have to do the same job anew or hire a developer again. Quite an unpleasant situation, right?

To avoid this problem, a child theme has been created. In it, you copy the files from the parent theme that you want to change. Then, act on them, not over the main ones. The simplest child theme consists of a “Style.css” file that connects a stylesheet from the main theme. Therefore, when updating, the main theme files will be updated, and all changes will remain as they were. In addition, it is convenient, because you know that you have edited – everything is in one folder.

You can also read about creating a Child Plugin.

How do I transfer changes from a Parent Theme to a Child Theme?

If you have not yet updated the theme, then not everything is lost. Just create from the old edited main theme – the child. You will need to find the files that have been edited, which you will need to move to a new folder, edit the “Style.css” file, and perhaps make a few more edits to other files. And do not forget about the pure parent theme, which will be the core of your secondary.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

Leave your comment