A child theme may inherit different things from the main theme


A Few Words on Theme Semantics

Child themes can certainly spin things around. Say that you love a particular theme, and it has a class called column-right, which is used to place the ever-present sidebar to the right side of the main content, in a suitable column. Fair enough. Problem is, you want it on the leftside, which you can easily fix by just applying float:leftin the style.css file of your child theme, possibly altering some other stuffas well, but you get the idea.

It works, but it is ugly to have an element named column-right positioned to the left. This may seem a bit nerdy, even trivial, but writing code that makes sense is important when several people are collaborating on a project, and also good form in general. While you may not care much about the latter (which sometimes is more than warranted), the former can prove to be a real issue for the best of us. The whole point of naming elements in design after what they actually are supposed to be is that you, and the people you work with, will have an easier time finding your bearings in the design.

So column-right should really be on the right side. That’s where you’ll look for it, thanks to the name.

Another popular example of this is the sidebar. A lot of people think that the sidebar.php template, or at least the actual term “sidebar” should be retired. It is something of a relic from the past, from the time when WordPress was about blogging only. Today it is a CMS, and you use it for a lot more than just publishing weblog posts. Why call it sidebar, why not sidecolumn? You can take the reasoning another step; what says that it will be on the side of things at all? Single column designs often position the sidebar.php content at full width below the main content, above the footer. There’s nothing wrong with that, other than that the sidebar obviously isn’t to the side.

Now, perhaps that’s taking it a bit too far. WordPress will probably keep using the sidebar lingo for quite some time, but that doesn’t mean that you need to name things column-right. It is something to think about when designing themes, because while a certain name may make a lot of sense in the present context, there’s nothing to say that you won’t be moving that column-right to the leftside. And if someone were to take your theme as a mother template theme for a child theme, that is even more likely to happen. So think about the semantics. It’ll make things easier on everyone.

Also, if you’re one of those people that think that this is a load of nonsense, or if you’re on the other side of the fence, being very vocal about correct semantics, feel free to pick the Notes Blog Core theme to pieces. Personally, I think it is a fairly usable compromise, but it could be better in both ways. It just proves that these are hard things to agree upon.

The Flipside of Inheritance

You already know that every file in a child theme takes precedence over its mother template theme’s counterpart. A child theme’s style.css trumps the style.css of the mother theme, and so does the child theme’s index.php compared to the mother theme’s index.php, and so on. The child theme inherits the contents of the template theme, but only if it needs it.

This brings up some issues, the most obvious probably being “what if they don’t match, designwise?” Well, the whole idea with child themes is to make customizations to themes you like. In other words, if you create a child theme based on a mother template theme that you end up changing altogether, with new template files for just about everything, one may wonder what the point is. After all, that is just like taking the original theme and making a new version of it, which may not bring us back to square one, but it certainly means that you’re missing out on the smooth upgrading perks that child themes can claim.

A child theme is most warranted for when most of your changes go in style.css and possibly in functions.php. The former can alter the look and feel of the theme, while the latter can change the necessary functionality.

So what’s the verdict, are child themes a good idea? In most cases, yes. Just don’t end up creating a brand-new theme rather than making stand-alone changes to an existing one. If you do, you’re better offcreating what you need from scratch, or rather, from that core theme you may have ended up creating by now.

Legal Disclaimer

Our website is not responsible for the information contained by this article. Webworldarticles.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.


This article was sent to us by: Gary Drumer at 05172010

Related Articles

1. Creating Your Own Wordpress Template Tags
Creating Your Own Template Tags Another way to access your plugin functionality is by creating your own template tags, much like bloginfo(), the_title(), and so...

2. Things to Consider When Using the wordpress Database
Things to Consider When Using the Database The database is sometimes necessary to make your plugins function the way you want. From storing some simple options,...

3. Developing Plugins for WordPress MU
Developing Plugins for WordPress MU The process of developing plugins for WordPress MU doesn’t differ from that for traditional Word- Press plugins. The s...

4. Wordpress Plugins and Functions PHP
Plugins and Functions PHP WordPress themes and plugins usually work pretty much by themselves, coming together only when it comes to implementing features. Th...

5. When to Use Wordpress functions php
When to Use functions.php When, then, is it really a good idea to use functions.php? I have a rule for that too: only use functions. php when the added function...

6. Are you using WordPress as a CMS
WordPress as a CMS Using WordPress for things other than blogging is something that comes naturally to a lot of developers today, but not so much for the ge...

7. Things to Consider When Using WordPress as a CMS
Things to Consider When Using WordPress as a CMS So you’re considering using WordPress as a CMS for a project huh? Great, and probably a good choice too...