How to get the Category Name for Event in the template
-
Hi there.
On the Single Event page I’m trying to get the name of one of the several categories the Event is assigned to. How to get it and use in the single-event.php?
For example:
Event_ID = 1234
It assigned to the categories ‘New‘, ‘Start‘, ‘Test‘, ‘West‘.The
<?php the_category(' • '); ?>
returns all these categories as the list.
But the
$category = get_the_category(); echo $category[0]->cat_name;
returns nothing. The array is empty.
How to get the name ‘Test’ for example?
Many thanks!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to get the Category Name for Event in the template’ is closed to new replies.