Displaying a List of Recurrences for a Single Event

This feature is available in Pie Calendar Pro 1.3.9 and later.

To handle event recurrences, Pie Calendar uses a library called PHP-RRULE. This library takes a set of specifications and returns an array of event recurrences. Because of the method we use, recurrences don't actually exists as posts in your database, so they can't be queried like normal posts.

This presents an issue for users who want to query an event and all its recurrences and display them in a custom manner, e.g. not using Pie Calendar's built-in display options.

While creating an individual post for each recurrence is prohibitively non-performant, we wanted to provide a solution that allowed users to view a single event's recurrences in an easy-to-digest manner.

As of Pie Calendar Pro 1.3.9, the Pie Calendar Info shortcode/block has a new fragment that does the following:

  1. If the event is recurring, it displays a link to your calendar page titled: "View all dates for this event." (filterable via piecal_single_mode_view_all_dates_link_text  ).
  2. When that link is followed, the user will be taken to your calendar page (designated via the datesurl  shortcode attribute or in the Pro Settings panel of the Piecal Info block.)
  3. The user will see the calendar in Single Event Mode, which means only the event they followed the link from will be displayed on the calendar, including all of that event's recurrences.

Using the Pie Calendar Event Info Block

To use the new fragment via the Pie Calendar Event Info Block, tick the "View All Dates" fragment in the block settings, then navigate to the Pro Settings panel and specify a calendar URL.

Using the piecal-info Shortcode

To use the new fragment via the piecal-info shortcode, include the viewalldates fragment in the fragments  attribute, and specify the calendar URL via the datesurl  attribute: [piecal-info fragments="viewalldates" datesurl="/calendar"]


Watch a demo video: ​https://www.youtube.com/watch?v=qAJnJj8Nvts​

Tips & Tricks

  • The "view all dates" link will not appear if no calendar URL is specified, so make sure to specify it in the appropriate manner depending on whether you're using the shortcode or the block.
  • If you want Single Event Mode to use a different view, create a separate page just for that purpose and designate that page's URL in the datesurl  shortcode attribute or the Pro Settings panel of the Piecal Info block.
  • When viewing the calendar in Single Event Mode, the user will see a notice above the calendar like this: "You are viewing dates for the {Event Name} event. To view all events, click here." This text is fully customizable via the piecal_single_event_mode_notice_text  filter. Here's an example:
add_filter( 'piecal_single_event_mode_notice_text', function( $string ) {
	$string = "Viewing only <strong>%1s</strong> instances. To view all, go to <a href='%2s'>the full calendar.</a>";
	return $string;
});

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.