how can i use this code " <?php the_category(' '); ?> " to display only 1 category (if post is in 2-3 category) ... i spend 1 hour in forum searching this.
Please help
how can i use this code " <?php the_category(' '); ?> " to display only 1 category (if post is in 2-3 category) ... i spend 1 hour in forum searching this.
Please help
he beat me to it...
To show it as a link use this:
<?php
$category = get_the_category();
if($category[0]){
echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>';
}
?>thanks ... ;) works perfect
Read my post above your last one.
you are fast :))
You're welcome. Glad you got it resolved.
You must log in to post.