ICS Calendar is fundamentally a tool for non-developer WordPress admins to have an easy way to display their external calendars seamlessly in WordPress sites. But many developers have also found it useful as a tool they can extend for their own purposes.
As its usage grows and new use cases come to my attention, I do what I can to ensure that the plugin continues to meet the needs of as many users as possible, with the goal of always remaining easy to use, and focused on retrieving and manipulating ICS (iCalendar Subscription) feed data within the WordPress context.
The plugin was built with the goal of displaying the calendar data, so the functionality has been written with that goal in mind. In some cases that has led me to write functions and methods in a way that is probably not quite as granular as it should be. Case in point, the main R34ICS::display_calendar()
method. It serves dual purposes: it parses the calendar data, and renders the template output.
Those really should be two (or more) separate methods. And in a future update, they’ll be refactored as such. But for now I’ve found a simpler way to address a specific developer need: to be able to access the fully parsed $ics_data
array the method generates, before it renders the template output.
That simpler way is encapsulated in the new r34ics_get_ics_data()
function, which is detailed more extensively in the Developer documentation. In short, this function takes an input array matching the same attributes you would typically put into the ICS Calendar shortcode, and it returns the parsed array, without generating any template output.
Most ICS Calendar users will never need to use this function, but if you need it, you need it, and now you have it!
This function is included in version 8.12.0, which is available now in the WordPress Plugin Directory or on your WordPress admin Updates page.
—Scott