WordPress Blown: get current category link

Found a great snippet today on the WordPress forums for retrieving the url for the current category.  Was useful in creating a lead into a category from a featured post on a homepage.  See it in action in the News box on Jwitty Spirits.  And pick up a bottle of organic liquer while you’re there!

<?php
$the_cat = get_the_category();
$category_name = $the_cat[0]->cat_name;
$category_description = $the_cat[0]->category_description;
$category_link = get_category_link( $the_cat[0]->cat_ID );
?>

<a href="<?php echo $category_link; ?>" class="category_logo">Read More...</a>

This entry was written by ross, posted on July 28, 2009 at 12:54 pm, filed under Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

Timeline

5 Comments

Have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

:

: