I have a custom post type called "Projekte" 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. 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