Having a calendar of events on your WordPress site is great. Wouldn’t it be super awesome if you could get those events into a personal calendar as well?

How to Subscribe to Events

You’re in luck. The Events Calendar includes a nifty option for you and your visitors to export the events or subscribe to the calendar on your website in a flash. Visit your calendar and you’ll notice a button at the bottom.

Subscribe to calendar on calendar page

Click on Google Calendar and you’ll be redirected to your Google Calendar, where you’ll be prompted to add events directly to your Google Calendar. It might take Google some time to get the events; they might not show up immediately. Also, if you choose this option, Google Calendar will update with any event changes from the website every 24 hours (this time frame is created by Google Calendar).

Use the iCalendar option to subscribe to the calendar in your iCalendar application. The frequency with which this calendar syncs with iCalendar will depend upon your iCalendar settings.

The Export .ics file option will download an .ics file for you to add events to any other application that you’d like. Once exported, this will not change, so you’ll need to export a new .ics file every time new events are added or modified.

Note: Access to the .ics file must be set to public, otherwise it will not display for your users.

If you’re wondering what the heck an .ics file is, it allows you to import events into a calendar application, like Apple’s iCal or Google Calendar. For example, here are the step-by-step instructions for importing an .ics file into a Google Calendar.

There are also links on individual event pages, so your customers can choose to add a specific event to their personal calendar. Note that when using the Add to link for Google Calendar, any updates to the event will not be synced to the user’s personal calendar.

Add to calendar buttons on single event page

Changing the default behavior

The subscribe functionality works the same way on every view.

It’s worth noting that by default, the subscribe and export features only allow the first 30 events. If you’d like to change that behavior, you can reference this article.

Note: The filters that affect the export link should also affect the subscribe links. For example, if you alter the number of events on the export link, it will affect the number of events on the subscribe link.

Syncing vs Exporting Differences

Note: There is a major difference between exporting events from your website calendar and subscribing to the calendar.  If you use the Google Calendar and iCalendar options, you’ll be able to subscribe to the calendar. This means that all new events and event updates will automatically appear on your personal calendar. Subscribing to events will always create a new calendar in your app.

With the export .ics option, you download a snapshot of the event(s) as they show on the site now. You can then import the event(s) into your personal calendar. If the events are updated on the source calendar, the updates will not show on your personal calendar. Similarly, new events added to the source calendar won’t be added to your personal calendar–unless you go back and download a new .ics file. When you add events from an .ics file, they can be added to your existing calendars in the app.

There you have it! You are now fully versed in exporting and synching your calendar’s events and importing them into another application.

If you’d like, you can customize which links display or revert to the old Export Events link. Here are some filters that you can add to your theme’s functions.php file in order to do that.

To revert to the Export Events link included in previous versions of The Events Calendar, use this snippet:

// Turns off the new dropdown and just shows the old download link.
add_filter( 'tec_views_v2_use_subscribe_links', '__return_false' );

To remove the Google Calendar link from the dropdown, use this snippet:

add_filter( 'tec_views_v2_subscribe_links', function( $subscribe_links ) {    
	if( $subscribe_links['gcal'] ) {
		$subscribe_links['gcal']->set_visibility( false );
    return $subscribe_links;
}, 12 );

To remove the iCalendar link from the dropdown, use this snippet:

add_filter( 'tec_views_v2_subscribe_link_ical_visibility', '__return_false', 12 );

To remove the .ics file download link, use this snippet:

add_filter( 'tec_views_v2_subscribe_links', function( $subscribe_links ) {
    $subscribe_links['ics']->set_visibility( false );

    return $subscribe_links;
}, 12 );

Altering the Single Event Export Behavior

By default, on the single event page, the + Add to Google Calendar link allows you to add the event to an existing calendar. However, the user will not get updates if the event is changed on the web calendar. You can use the following snippet to change the link so that it acts as a subscription. With this filter, the subscribed user will see any event updates on their personal calendar.

add_filter( 'tec_views_v2_subscribe_links_gcal_single_url', '__return_false' );

The + Add to iCalendar link creates a new calendar subscription in the Calendar app. The user will get updates in the app if the event is changed on the web calendar.

If you use the Classic editor, you can also choose to add an Export .ics link to the single event page, like the one that appears on calendar views. To add that link use the following filter:

add_filter( 'tec_views_v2_subscribe_link_ics_visibility', '__return_true', 20, 2 );

Additional Filters

You can also apply the following filters if you’d like to further alter the subscribe and export behavior with Google Calendar:

  • tec_views_v2_single_event_gcal_link_base_url: allows filtering the base URL used for the single event (import) link
  • tec_views_v2_single_event_gcal_link_parameters: allows altering the params passed to gCal in the link
  • tec_views_v2_single_gcal_subscribe_link: allows altering the link itself once params have been added