Reply To: Is there a way to link to a specific event?

Home Pro Support Forums General Support Is there a way to link to a specific event? Reply To: Is there a way to link to a specific event?


At this point this is not something the plugin can do automatically, but it would probably be possible with a bit of custom jQuery.

The first thing you’d need to do is give the calendar an ID Attribute. (This is under the Advanced tab of the Calendar Builder, or if you put it directly in the shortcode, it’s guid.)

Once you’ve done that, if you inspect the code on the page, you’ll see that each date’s list has a aria-labelled-by attribute that consists of the ID Attribute, a hyphen, and the date in YYYYMMDD format, like this:

<ul class="events" aria-labelledby="my-id-attribute-20230313">

Then within the list, the li.event tags have a class indicating the starting time of the event, in tHHMMSS format, like this:

<li class="event t093000">

Unfortunately there’s not a distinction between multiple events that start at the same time, so if you try to do this with an event that shares its start time with another event, you’d have to add some additional logic (i.e. :nth-of-type()) to what follows.

This all gives you a way to write some jQuery with a selector targeting the event, which would look like this:

jQuery('.ics-calendar .events[aria-labelled-by="my-id-attribute-20230313"] .event.t093000')

You could add a special query string to the URL of the page, check for that on page load, and then trigger the lightbox. It may look something like this. (Note, I have not actually tested this code, it’s just the idea.):

jQuery(window).on('load', function() {
    if ('whatever-you-add-to-the-query-string') != -1) {
        jQuery('.ics-calendar .events[aria-labelled-by="my-id-attribute-20230313"] .event.t093000').trigger('click');