Support

Home Forums Event Espresso Premium Add Category Identifier to Template Tags?

Add Category Identifier to Template Tags?

Posted: September 26, 2013 at 6:04 pm


Sarah Rogers

September 26, 2013 at 6:04 pm

Hello,

I want to output the category identifier a tag in my registration_list_display.php file so that I can modify my css based on the category. I’m able to output the category id using

<div id="event_espresso_registration_form" class="cat<?php echo $event->category_id; ?> which returns the correct category array – however, since it returns something like 1,9, I cannot alter it using css. Is there a way to use the category identifier or name?

Thanks,
Kindra


Dean

September 27, 2013 at 3:00 am

Hi,

You can use this shortcode – https://eventespresso.com/wiki/shortcodes-template-variables/#event-category

In the template file you would add it like this:

<?php echo do_shortcode("[CATEGORY_NAME event_id=" . $event->id . "]"); ?>


Sarah Rogers

September 27, 2013 at 8:42 am

THANK YOU! I was pulling my hair out on that one!

The support post ‘Add Category Identifier to Template Tags?’ 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