Category Archives: Wordpress

is_subcategory()

Ok, I just spent the better part of ALL DAY trying to figure this out.

I want my wordpress category.php template to be able to detect whether the category it is serving is a parent category or subcategory. THATS IT. And without having to hard code any category ID’s. After perusing the forums and codex for a couple of hours, the marriage of these two functions seemed to get the job done.

get_query_var is the variable stored in the query that tells category.php what category to serve.

get_category retrieves category data given a category ID or category object.

Here’s the function that goes in your functions.php file:

Then you can use this in your category.php file to determine if the category you are serving is a parent category or subcategory:

Hope this helps some people out there.

*note: both code snippets should be wrapped inside php brackets. <?php ?>

WordCamp NYC 2009. Be there, or be square.

WordCampNYC – Nov 14-15

I’m very excited to say that I will be attending WordCamp NYC 2009. I have been working with WordPress for the past two years and it has completely revoltuionized the way I design web sites.

If it weren’t for WordPress, I wouldn’t lead the life I live today. But that aside, its exciting to participate in such an awesome community. I look forward to meeting fellow WordPress users and abusers.