I have a custom post type called "Projekte""Projects" and for it some categories.
I would like to display the category name of the posts in the loop but only once.
I am using this but the category is being displayed on top of every post.
For example if the 2 posts are in the same cetegory, now I see the category name twice in the same loop.
How can I solve it?
My code:
<?php
$category = the_category();
?>
<h2 style="text-transform: uppercase;">
<?php
if($i == 1) {
echo $category[1]->cat_name;
}
$i++;
?>
</h2>
Many thanks in advance