Wordpress Category Link

Status
Not open for further replies.

droplister

New member
Aug 23, 2007
1,233
21
0
NYC
I can't for the life of me figure out how to get a post's category link from outside the loop.

I want to call the category from my header file for bread crumb navigation. I can call the title just fine, but all the solutions I've tried result in Object #[number] rather than the link. Is that because I'm treating the call wrong or something? Anyone know? It seems to me there should be a function for this already, but I can't locate it
 


I've just added it now, it works just fine. I've run into other things like this on a different site where the solutions were real messy calls on the db.
 
Have you tried this -
Code:
global $post;
$base = get_bloginfo('url');
$category = get_the_category($post->ID); 

echo '<a href="<?php echo $base.$category[0]->category_nicename; ?>"><?php echo $category[0]->cat_name; ?></a>';
 
Status
Not open for further replies.