Support

Home Forums Event Espresso Premium Event Category on Registration Page

Event Category on Registration Page

Posted: September 14, 2013 at 1:22 pm


Hansteen

September 14, 2013 at 1:22 pm

I am making a custom template for the registration page and I was wondering if there is a template variable in order to display the event category.


Dean

September 15, 2013 at 7:52 am

Hi,

The $event variable stores most of the information.

It is probably easier to use this shortcode though https://eventespresso.com/wiki/shortcodes-template-variables/#event-category as it just requires the event id and will grab all the event categories associated with the event for you


Hansteen

September 15, 2013 at 8:25 pm

I’m editing registration_page_display.php and trying get it to display whatever the category of the current event is, but I’m not sure which variable to use. For example, to display the venue I would use <?php echo $venue_title; ?> Is there a similar variable to grab the category of whatever event is being displayed?


Dean

September 16, 2013 at 12:34 am

Hi,

There isn’t a variable liek that for the category, you would either need to pull the category ID out of the $event variable, or just use

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

in the template file. It will output the Category name.

https://eventespresso.com/wiki/shortcodes-template-variables/#event-category


Hansteen

September 16, 2013 at 10:32 am

Thanks, that worked. For future reference, how would I pull the category ID out of the $event variable?


Hansteen

September 16, 2013 at 10:59 am

One other thing: is there a way to put the category into the confirmation email? I tried the code above and it didn’t work.


Dean

September 17, 2013 at 1:11 am

Hi,

To display it would be

<?php echo $event->category_id; ?>

to add it to a variable would be

<?php $avariable = $event->category_id; ?>

$event is an object variable.

There isn’t a category email tag unfortunately. You could work around it by adding the Category name to a meta tag, a little bit more work, but other than that you would have to generate a new email tag which involves editing core files.

There is a full list of email tags available here https://eventespresso.com/wiki/custom-email-tags/


Hansteen

September 17, 2013 at 8:27 am

Thanks!

The support post ‘Event Category on Registration Page’ 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