I'm trying to display only the first category for a post but the_category() displays all of them and there don't seem to be any arguments to accomplish this. Can someone lend a hand? Thank you!
I'm trying to display only the first category for a post but the_category() displays all of them and there don't seem to be any arguments to accomplish this. Can someone lend a hand? Thank you!
Take a look at get_the_category
<?php
$category = get_the_category();
echo $category[0]->cat_name;
?>
http://codex.wordpress.org/Function_Reference/get_the_category
You must log in to post.