To show post category name in a single post use this simple code snippet.

<?php $cat = get_the_category(); echo $cat[0]->cat_name; ?>

As we know we can assign multiple categories in a single post. to show specific category use can use a number in the above code snippet.

For example:
If you have selected 3 categories in your single post you can print 3rd category by entering [2] number.

<?php $cat = get_the_category(); echo $cat[2]->cat_name; ?>

WordPress start counting from "0"


If you want to show all categories in your single post, use the below code snippet.

<?php the_category(', '); ?>

You can use comma (,) or any other element to separate categories.