When working with WordPress theme frameworks or any parent theme, sometimes you might want to figure out whether a child theme is active or not. Here’s a quick function that’ll do exactly that:
function has_kids() {
if (STYLESHEETPATH !== TEMPLATEPATH) return true;
return false;
}
if ( has_kids() ) {
// do stuff
}
This function works whether you call it from a child theme or parent.
That’s a cool little snippet of code. I’m not sure what I’d do with it yet, but it’s good to bookmark away for later.
On the same path… If you have a child theme (I’ll use Ian Stewart’s pro/paid Thematic child theme called Power Blog, as the example) and want to customize that – what do you do? Currently we’re talking about customizing themes by using Child Themes. If I wanted to make mods to Power Blog, I’d have to change the child theme directly, thus negating some of the reasons for using a Child theme – like upgradability.
Do we get to a day where we need grandchildren themes? I think your code might be the start of a way to “group” the family theme files together.