Creating a custom view

It's possible to register a new custom view using the piecal_calendar_object_properties hook.

add_filter( 'piecal_calendar_object_properties', function( $properties, $eventsArray, $appendOffset ) {
	$newProp = "views: {
    	listMonthTwoMonths: {
      		type: 'listMonth',
      		duration: { months: 2 }
    	}
  	},";
	
	$properties = [...$properties, $newProp];
	
	return $properties;
}, 10, 3 );

Once a new view is registered, you'll need to switch to it at runtime using JavaScript:

window.calendar.changeView('listMonthTwoMonths');

You may also want to update the title of the Calendar so it doesn't show an incorrect month:

Alpine.store('calendarEngine').viewTitle = "Upcoming Events";

Unfortunately, at this time, there's no built-in way to add a custom view to the dropdown list or choose it as the default view via Pie Calendar's shortcode attributes.

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