Introduction To Child Themes…..What They Are and How To Use Them
In the latest versions of WordPress, 3.0 and later, they have introduced the possibility of using Child themes. By using Child themes in your WordPress website, you can modify or change (override, actually) all aspects of a Parent theme. In other words, you now are able to change the settings in the stylesheet, page templates, and functions of the Parent theme without having to worry about loosing all of your modifications when upgrading the Parent theme.
That is because when you upgrade, only the Parent theme files are changed. Your child theme files remain unchanged, so they are still available to modify the Parent theme files just as they did before the upgrade.
Before proceeding with this discussion on Child themes, I will tell you that it is assumed that you are familiar with the WordPress admin area, and have at least some basic knowledge of editing html, php, and css. In order to edit theme files, you would use the Editor link under the Appearance tab in your WordPress admin area. You can then choose which theme file to edit.
So, here is what we are talking about…..
How do Child themes work?
A Child theme is nothing more than a stripped down version of the Parent theme. It’s really very simple to create your own Child theme. All a Child theme requires is it’s own folder (name it whatever you want), and a stylesheet. That’s it, you’ve created a Child theme. You would then need to upload the folder to your sites theme folder, which is in the wp-content folder.
You can activate your newly created Child theme using the same procedure you use to activate any WordPress theme using the wp-dashboard.
Your Child theme stylesheet will need to contain a reference to the Parent theme. By doing that, all theme options, settings, widgets, page templates, etc will be a part of the Child theme. The only purpose of the Child theme, (all it can do, actually) is to override or overrule certain aspects of the parent theme.
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 theme stylesheet, and then those specifications override the specifications in the stylesheet in the Parent theme. Pretty neat, huh?
So, here is how it works…..
If a specification, for instance one defining text color, appears twice in a stylesheet, the last one listed prevails.
You can change just part of a specification if desired. For example, assume that your Parent theme 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-family: Arial, Helvetica, sans-serif;
font-size: 14px;
line-height: 16px;
}
Next, let’s say all you wished to change was the font size, say from 14px to 12px, for your site. Very easy to do, really. In your Child theme all you have to specify is that specific 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;
}
So, the huge advantage of using a Child theme is that you only need to add your desired changes to the Child theme stylesheet, and they will override the Parent theme settings. Then,once your Child theme is activated, it will behave just like the Parent theme. Any desired modifications can be done in the Child theme, thus leaving the Parent theme unchanged, making it easier and simpler to upgrade the theme without losing all of your modifications.
In addition, you can add other theme files (such as the index.php file) to your Child theme, and you can then make specific modifications to that file. The way it works is that if a file is included in the Child theme, WordPress will use that version. If it is not, WordPress will revert back to the Parent themes’s file.
If you want, you can also add specific functions (this is pretty much for advanced users) by also including a functions.php file in the Child theme folder. Any functions in this file will be used in addition to the themes default functions.
When should you use a Child theme?
If you plan to modify the theme you are using on your site, and you wish to be able to upgrade easily without having to remember which theme files you modified, and reapply your modifications to each of those files, you should use a Child theme.
Conversely, if you are satisfied with the Parent theme as is, and will not be making any changes, then there is really no need or reason to use a Child theme.
iThemes and Child themes
For several years now, I have been using iTheme Premium Themes on nearly all of my WordPress websites, and I wholeheartedly recommend them to all of my customers. The next articles in this series on Child themes will be geared towards creating and using Child themes in conjunction with iThemes themes.
Stay tuned to learn more about using Child themes on your WordPress website to make your theme modifications easier, quicker, and therefore, MORE FUN!
Wordpress Premium Themes & Plugins & Advanced Wordpress Training.....Find Them At WpSiteBuilder.com



