Create Child Theme in WordPress

In the latest versions of WordPress i.e. 3.0 and later, it has been made possible to use Child Themes. Several WordPress users do not understand the importance of using Child themes, and this is why we have taken the initiative to explain to you what Child themes are and why you should start using them. By making using of them, you can easily modify or even change all the aspects of the parent theme. In simple terms, you will be able to change the setting in the page templates, stylesheet and the functions of the parent with no fear of losing the modifications when you upgrade the parent.

This is so since when you upgrade, it is only the parent files that are actually changed and your child theme files will remain unchanged so you can still modify the parent files as you did before the upgrade. Before we can go further, it is good to note that, it is assumed that you understand WordPress Admin area and you also have some basic knowledge of PHP, HTML, and CSS. To edit your theme files, you will use the Editor link under the Appearance tab in the WordPress admin area. You can, therefore, choose the theme file that you would like to edit.

So, this what we are talking about.

How to create Child Themes

A Child theme is simply a stripped down version of the parent. It is very easy to create your own child theme. Every child requires its own folder using any name you may want and a stylesheet. It is that simple. After creating your own folder, you would then have to upload the folder to your site theme folder found in the wp-content folder.You can as well activate your newly created Child using the same procedure used to activate the WordPress theme using the wp-dashboard.
Your Child theme stylesheet should have a reference to the Parent. When you do so, all the theme options, widgets, settings, page templates and others will be a part of the Child. The core purpose of the Child is to overrule or override certain aspects of the parent.
Due to the way CSS works, and the way it’s interpreted by the browser, using cascading stylesheets (CSS) allows you to add your own desired specifications in the Child stylesheet, and then those specifications override the specifications in the stylesheet in the Parent. Nice, huh?
So, here is how it works.
If a specification, for example one defining text color, appears twice in a stylesheet, the last one listed prevails.
You can however, change just a specific part of a specification if you want to. For instance, let us assume that your parent stylesheet uses the following specifications:

body { /* This is where you would set many of the universal defaults for the theme */
background: #fff url(images/body-bg.gif) repeat-x;
color: #333;
font-size: 14px;
line-height: 16px;
}

Next, let us assume that you would like to change was the font size, from 14px to 12px, for your site. Very easy to do, actually. In your Child theme all you have to specify is that particular property (font-size in this case), while all the other remaining properties would stay as they are.
Here is an example of how to do it:

body { /* This is where you set many of the universal defaults */
font-size: 12px;
}

Benefits of using a Child theme

One of the advantages of using a child theme is that you only need to add your desired changes to the Child stylesheet, and they will override the Parent settings. Once you activate your child, it will behave like the parent. If you want to do any other modifications you will do it in the child hence leaving the parent unchanged. This makes is simple and easier to upgrade the theme without losing all your modifications.
Again, you can as well add other theme files to your child then make certain modifications to that file. If the file is added to the child theme, that version will be used by WordPress. If it is not used, WordPress reverts back to the parent file.

When is a Child theme used?

If you are planning to modify the theme on your site without having to remember the file you changed, and you wish to be able to upgrade easily, and reapply your modifications to each of those files, you therefore, need to use a Child.

Conclusion

Child themes have made the task of modification effortless and fast. Make a point of creating a child theme and make your experience with themes more interesting.

By | 2016-10-28T13:43:40+00:00 October 28th, 2016|Help|