0

How can I get the name of a category in a custom template of the Event Organiser Plugin.

So far the only thing I can get it slug of the category by reading the following variable:

echo $eo_event_loop->query['event-category']; // test-cat

From digging a little in standard template the only thing I found is that they use the standard WP function single_cat_title()

echo single_cat_title( '', false );

But it doesn't generates any output in the template.

The template based on the following two global variables:

global $eo_event_loop,$eo_event_loop_args;

From what I can find in function reference of the Event Organiser plugin there is not such a function I'm looking for.

closed as off-topic by gmazzap, Howdy_McGee, kaiser Apr 6 '16 at 22:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

0

Okay I found the solution. A view in the mySQL table helped to understand how the Event Organiser plugin is using Wordpress. The Event Categories a just normal categories with the taxonomy event-category. The only function needed is get_term_by().

// Get term by slug ''test-cat'' in event-category taxonomy.
$cat = get_term_by('slug', $eo_event_loop->query['event-category'], 'event-category');
echo $cat->name; // Output: Test Category

Not the answer you're looking for? Browse other questions tagged or ask your own question.