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:

function is_subcategory (){
    $cat = get_query_var('cat');
    $category = get_category($cat);
    return ( $category->parent == '0' ) ? true : false;
}

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

if ( is_subcategory() ):
     //displaying subcategory
else:
    //displaying parent category
endif; 

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.

My beef with the CMJ festival

Ok so ever since I can remember the CMJ Festival, I would peruse the listing of bands playing and for one reason or another would never recognize any of them. Now I do understand its a showcase of emerging artists, so chances of my having heard them before is slim. HOWEVER, after the fact I always come to find out that bands I DO actually like ALSO performed, but it wasn’t really advertised or promoted. WTF ?!@#$

Ok so that’s my beef with CMJ. However one year I did manage to see Dillinger Escape Plan open up for Ol’ Dirty Bastard (RIP) on a CMJ Showcase. Badass.

Go back to Google’s original size search bar

So as some of you may have noticed, Google made their search bar more accessible to the geriatric community by enlarging the search bar and font size. Now as a human being (aka ‘creature of habit’), this bothers the hell out of me. I’m totally not used to it, I don’t want to get used to it. Just put it back to normal.

In comes, GreaseMonkey.

Now I’ll be the first to admit, I have a problem with Firefox plugins, in that I use entirely too many. But this one is totally worth it. With user scripts that return the Google search bar back to normal, pimp out your google reader, AND google calendar, you can’t go wrong.

I’ve fallen in love.

Links courtesy of Lifehacker.

Moving Out (Anthonys Song)

Hanging with Gillian watching some “Mystery Science Theater” Zombie Nightmare edition. Cleaned, did laundry, did mockups for a friends site, updated another.

Busy.

Learning about tracking pixels for a custom home takeover. Need to learn new things, or extend my knowledge of current topics further.

I’m attending WordCampNYC next month and looking very forward to it. I’ve been using WordPress for the past two years and couldn’t think of a better way to learn about the worlds best
Web publishing platform.

Also supposed to be moving out next month, which I am extremely excited about. Especially since I’ll be moving in with my girlfriend of three years. Good times ahead.