Parent “Page” or parent “category”? I’d like to know how to do this with parent category — something like is_category_parent(). Or the reverse, if there was a way to say that it is the child of a category — like is_category(child=10).
Thread Starter
xortw
(@xortw)
Well it is ‘parent Page’ in my case.
If all you want is a quick fix and your problem is limited to being able to include children of a parent category when testing for is_category(), you could do this:
Check functions.php inside /wp-includes/ and around line 1295 you’ll see the function that actually does the is_category test. It begins:
function is_category ($category = '') {
and then proceeds to do a number of tests. I added one more test:
else if ($category == $cat_obj->category_parent) {
return true;
}
That way, I can have a conditional tag that will result in “true” if a post or posts are either in a category or in a child of said category.
This may not be of use to you, but, after lurking on these boards for too long, I thought I’d start sharing some of the things we’ve been doing to get around the understandable limitations of this Blog-turned-CMS called WordPress.
“Blog-turned-CMS“
Thought I’d note that WordPress hasn’t made any turns. WordPress may be a blogging system with CMS-like features, but it is for blogs first and foremost.