Home Forums Event Espresso Premium Get Event Category

Get Event Category

Posted: September 4, 2012 at 5:42 pm


September 4, 2012 at 5:42 pm

I would like to display something on the event registration page only for a specific event category. Is there a code that I can use to pull this data?

For example your code uses this for the venue name:

echo $venue_title != ''?''.stripslashes_deep($venue_title).'':''

How would I do this for Category? Is it something like this:

echo $category != ''?'stripslashes_deep($category)':''

Sidney Harrell

September 4, 2012 at 6:11 pm

It looks like the category data is not pulled on the registration page. So you’d have to do something like:

    $sql = "SELECT cd.category_identifier FROM " . EVENTS_CATEGORY_TABLE . " cd JOIN " . EVENTS_CATEGORY_REL_TABLE . " cr ON cr.cat_id = WHERE cr.event_id = '%s'";
   $results = $wpdb->get_col($wpdb->prepare($sql, $event_id));
   echo  in_array('my_cat_identifier',$results) ? 'My Category Message' : '';

That should work.


September 6, 2012 at 10:19 am

Perfect, thanks!

The support post ‘Get Event Category’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso