Support

Home Forums Event Espresso Premium Displaying related events on registration page. Is this possible?

Displaying related events on registration page. Is this possible?

Posted: March 5, 2013 at 12:57 pm

Viewing 8 reply threads


Christian Seeber

March 5, 2013 at 12:57 pm

Hi there! Let’s say I have several events on my calendar of the same type. Is there a way for me to sort of link these events so that on the registration page I can automatically list the other related events?

Even better. Can I display the dates of these other events? You know? Sort of like “if you can’t make it to this one, maybe these other dates work for you.”


Jonathan Wilson

March 5, 2013 at 1:54 pm

Hi Christian,

This isn’t something that is possible out of the box. However, I have an idea. You could use a Related Post plugin, then created posts for your events and use the “Related Post” plugin as a Related Event list.


Christian Seeber

March 8, 2013 at 11:55 am

I wound up writing a custom function to get this working. Figured I’d post here what I did in case anyone else ever comes around looking for something like this.

http://pastebin.com/zNzzZkSa

I call it like this on the page:

where $recurrence_id = $data->event->recurrence_id;


Christian Seeber

March 8, 2013 at 11:56 am

Rather, I call it like this on the page: echo list_recurrent_event_dates($recurrence_id);


Jonathan Wilson

March 8, 2013 at 11:59 am

Hi Christian,

Thanks for this information.

Are you putting this in your functions.php file of your theme?


Christian Seeber

March 8, 2013 at 1:15 pm

I put it in custom_functions.php


Jonathan Wilson

March 8, 2013 at 1:26 pm

Great. Thanks for sharing your code with us. That may be helpful for someone else in the future.


Tony Warwick

March 8, 2013 at 3:15 pm

There’s a small problem with that function, it will return dates for the events no matter what the status of the event. So your visitors may go through multiple unavailable dates before finding one that’s open.

If you have closed, deleted or expired events within that recurrence you will still get dates/links for those events.

I’ve modified the function to only use active events, to check the reg status of the event and if open then display the date and also use HOME_URL() to output an absolute path rather than relative to be used in other pages and also only selected id and start date from the DB rather than the full row as that’s all that’s being used.

I did something similar using EVENT_LIST (added custom templates to be called when using the shortcode i.e EVENT_LIST template=event_list_dates.php) a while back but knew it was over kill at the time, like this method better.

Anyway credits to Christian for the original.

Here is the function: http://pastebin.com/cD7iNgWX


Tony Warwick

March 8, 2013 at 3:43 pm

Apologies,

Removed HOME_URL() and used EE’s own espresso_reg_url function.

http://pastebin.com/sPV9TsVx

Viewing 8 reply threads

The support post ‘Displaying related events on registration page. Is this possible?’ 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