Support » Plugin: The Events Calendar » iCal display explicitly set to `list` returns events in wrong order

  • Say you have a site set up where the default event view is Month. By default, the iCal link will return events in the current month.

    This is usually probably undesirable, but I won’t argue for another default on iCal requests here. Let’s instead say that you explicitly navigate to the iCal template for the list view:

    https://example.org/events/list?ical=1

    In /src/Tribe/iCal.php, get_event_posts uses the global $wp_query args when fetching the default list of events, which has the order set to DESC (among a bunch of other defaults). That means that once you get to tribe_get_events, the default order ASC is overridden.

    So the iCal template will return the furthest out events first, and if you have more future events total than the number of events being fetched, it won’t return the closest upcoming events.

    This also means that the fallback to array_slice on get_events_list (same iCal.php file) will get events in the wrong order.

  • The topic ‘iCal display explicitly set to `list` returns events in wrong order’ is closed to new replies.