As a WordPress designer, one of the things you need to keep in mind is the addition of new features with new versions of WordPress, and in turn the deprecation of old ones. A theme created a few years ago will probably still work, but it will definitely be lacking some of the newer functionality of more modern themes. And the further question is, will it still work in another few years? The backwards compatibility in WordPress is pretty extensive, but there’s a line to be drawn, of course.
Compatibility is one of the many reasons why you create core themes to build on, and why using child themes to extend them is such a great idea. In a way, the child theme concept is all about moving the individual styling for the sites you create another step from the code, since the child theme will consist mostly of visual enhancements and changes to the core theme. That means that the user can update the core theme without breaking anything.
Child themes are a fairly new concept that started blooming with WordPress 2.7, where the support for them was greatly improved. Basically, you create themes that rely on other themes as templates (mother themes, if you will), and that in turn means that you’ll only have to change the things you dislike in the child theme.
For example, say you love a particular theme, but dislike the fonts and colors. You may also think that it needs a few Page templates to meet your needs. There are two ways to tackle this problem. The most obvious is also the direct route: just open the theme’s files and edit them to your heart’s content. In this case, that would mean doing some changes in style.css (for the fonts and colors), and adding a couple of Page templates. No big deal, right?
Wrong. What happens when the theme author updates the theme with brand-new functionality, and you, giddy with joy, upload the new version and see all your edits go away? Obviously, your edits, with the colors you changed and your Page templates, aren’t included in the original author’s theme, so now you’ll have to recreate all your adaptations so that the theme fits your needs again. You can of course keep notes of what you change, and back up your altered files, but the new version of the theme may have several changes and (re)applying your edits will be at best a bore, at worst tricky and time consuming.
Hacking a theme may be a simple solution, but if you want to be able to upgrade it with new versions with your edits intact, there is a better way. What you do is create child theme, using the original theme as the mother theme (or template, as it is called when defining it). The child theme sits in its own folder, and so do all its associated files, so when you upload the new version of the original theme that you’ve built your site upon, you’ll only overwrite that theme’s files, and not your child theme, which contains all your changes. In other words, none of your edits will go away on updating the main theme. The whole idea is to separate the main theme functionality, code and content from your own edits and adaptations. And since those will reside in your child theme’s area they are safe from the template theme’s updates.
Any theme can be the mother of a child theme. The only thing that is really important is that the theme is located in your wp-content/themes/ folder (because otherwise you can’t use its files), and that the child theme is in its own folder, just like a regular theme. So if you want to use the Notes Blog Core theme as a mother template theme, you need to have it in the wp-content/themes/ folder, and then you can have your very own Small Notes child theme (or whatever you want to call it) in its own folder, also in wp-content/themes/.
If child themes are in wp-content/themes/ just like ordinary themes, then how do you use them and what do you need? Basically, all you need is a style.css file to tell WordPress that it is a theme, and in fact a child theme, as well as point to the mother theme. Whenever a template file is called for, WordPress will look for it within the child theme, and if it isn’t there, it’ll load up the one in the original mother template theme. The lingo may be a bit hard to follow, by the way, because the community really hasn’t decided on what to call this relationship between themes yet.
Our website is not responsible for the information contained by this article. Articleinput.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.
Note: This article was sent to us by: Keith Branger at 05172010
1. How to do lifestreaming with WordPress
All articles are property of their respective authors. Please read our Privacy Policy!
© 2009 ArticleInput.com.
Partners: Damenmode