Child themes – how and why create them?

wordpress-child-theme-development

To begin with, that the availability of predefined themes, both free and paid, is extremely high. Despite this, users often want to modify prepared earlier themes and change them which is not necessarily need to in not very correct way. Modification of predefined themes is not considered as a good idea, because of the fact that the authors often include updates to their motives. Therefore, if you, dear users try to modify any files which had been updated earlier, you will unfortunately have to say goodbye to the elements added by you. How to avoid this kind of problem? With help comes mechanism, called child themes.

What is a child theme?
It’s very simple. The entire mechanism lies in the fact that, assuming a new theme, WordPress announce that if within the same theme can not find the page to display, you should use the theme ‘parent’ whose ‘child’ is created by you. In addition, you can freely update your theme base, because it does not contain any of our modification.

How to create a child theme?
Firstly, in the directory wp-content / themes create a directory named NAME_BASE_THEME-child, and add the style.css file. -child Suffix of course is not required, but it is a fairly common procedure, suggesting that it has to do with the theme for a particular child theme. The following code includes, of course, a simplified version of the file style.css

In line Template: Parent Child Theme theme must specify the name of the base. In the following lines, enter data that is consistent with the information on a theme that will be a descendant. If you do not want to use the @import option to CSS code from the underlying theme, you have the possibility of using a different method. Now, you create functions.php file, and then you add in the following code:
Both the base theme and child, load fine functions.php file, and the first is loaded child theme, then parent theme, so that you can overwrite the selected features from the base theme. If to your functions.php file you add the “add_decoration”, it will replace the analogous functions of the parent theme.

Why use a child theme?
With themes child, you will have the ability to update the parent theme, while maintaining all your changes. Moreover, such a modification will be last much faster. With child themes, you, dear users will have the opportunity to develop their skills in the software which is WordPress.