Posted: 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.” |
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. |
|
|
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. I call it like this on the page: where $recurrence_id = $data->event->recurrence_id; |
|
Rather, I call it like this on the page: |
Hi Christian, Thanks for this information. Are you putting this in your functions.php file of your theme? |
|
|
I put it in custom_functions.php |
Great. Thanks for sharing your code with us. That may be helpful for someone else in the future. |
|
|
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 |
|
Apologies, Removed HOME_URL() and used EE’s own espresso_reg_url function. |
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.