Showing fewer overlapping events in GravityCalendar
When several events share the same time, a calendar shows every one of them. They sit side by side in the Week (Agenda) and Day (Agenda) layouts, and each extra event makes them narrower. In Month (Grid), a busy day grows tall enough to list them all.
A short code snippet sets how many events to show and puts the rest behind a link such as “+5”. Clicking the link opens them in a popup.

Limit the events in a time slot or a day #
Add the code below to your site. Replace 7 with the ID of your calendar. The ID is the number in the calendar’s shortcode, such as [gravitycalendar id="7"], shown under Embed Calendar in the calendar’s settings.
add_filter( 'gravityview/calendar/options', 'gk_calendar_limit_overlapping_events', 10, 3 );
/**
* Shows fewer overlapping events on one calendar and puts the rest behind a "+ more" link.
*
* @param array $calendar_options The calendar's FullCalendar options.
* @param int $form_id The ID of the calendar's form.
* @param int $feed_id The ID of the calendar.
*
* @return array The options, with the limits set.
*/
function gk_calendar_limit_overlapping_events( $calendar_options, $form_id, $feed_id ) {
// The ID of your calendar. Delete these three lines to limit every calendar.
if ( 7 !== (int) $feed_id ) {
return $calendar_options;
}
// Week (Agenda) and Day (Agenda): events side by side in one time slot.
$calendar_options['eventMaxStack'] = 3;
// Grid layouts and the all-day row of the Agenda layouts: events in one day.
$calendar_options['dayMaxEvents'] = 5;
return $calendar_options;
}Note: Read Where to put code samples to learn how to add this code to your site.
Each setting works in different layouts, and you can delete the one you don’t need:
eventMaxStacksets how many events sit side by side in one time slot of the Week (Agenda) and Day (Agenda) layouts. With3, a slot with eight events shows three and a “+5” link.dayMaxEventssets how many events a day lists in the Month (Grid), Week (Grid) and Day (Grid) layouts, and in the all-day row of the Agenda layouts. With5, a day with nine events lists five and a “+4 more” link.
To limit a day by rows instead, use dayMaxEventRows in place of dayMaxEvents. The link takes one of the rows, so 3 shows two events and the link.
These are options of FullCalendar, the calendar library GravityCalendar is built on: eventMaxStack, dayMaxEvents and dayMaxEventRows. The gravityview/calendar/options filter can set any of them.
The result on your calendar #
Clicking the link in Day (Agenda) or Week (Agenda) opens a popup with the events the time slot hides:


In Month (Grid), the popup lists every event of the day, the ones already shown included.
