My most favorite blogging platform, soon to be used as a CMS, WordPress today released their 3.0 Thelonius edition.
Tag 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:
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.
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.
WordPress: Displaying List of Authors with Avatar
I found this awesome article by C. Bavota on how to display a list of blog authors with avatars. Check it out:
How to Display an Author List with Avatars in WordPress.
How to Create a Custom RSS Feed in WordPress in 12 Lines of Code « Denver SEO & Web Design Blog
Hey all you WordPressers out there. I came across this great article by Zack Katz. I was racking my brain on how to do this, and he saved my sanity.
How to Create a Custom RSS Feed in WordPress in 12 Lines of Code « Denver SEO & Web Design Blog.

