• We have events that are recurring (either daily, weekly, monthly, or yearly). We’ve made our own plugin that calls filters contained in The Events Calendar plugin.

    For example:
    add_filter('tribe_events_get_current_month_day', 'getRecurringEventsForMonthDay');

    In that function, we do a query for events that are recurring. After the query we will do some logic to see if the event is recurring on the date requested. Here’s the query:

    SELECT posts.*, metaStartDate.meta_value as EventStartDate, meta.meta_value as EventRepeats, metaTimeSpans.meta_value as EventTimeRanges
    FROM $wpdb->posts posts
    LEFT JOIN $wpdb->postmeta meta ON (posts.ID = meta.post_id AND meta.meta_key = '_EventRepeats')
    LEFT JOIN $wpdb->postmeta metaStartDate ON (posts.ID = metaStartDate.post_id AND metaStartDate.meta_key = '_EventStartDate')
    LEFT JOIN $wpdb->postmeta metaRepeatsUntil ON (posts.ID = metaRepeatsUntil.post_id AND metaRepeatsUntil.meta_key = '_EventRepeatsUntil')
    LEFT JOIN $wpdb->postmeta metaTimeSpans ON (posts.ID = metaTimeSpans.post_id AND metaTimeSpans.meta_key = '_EventTimeRanges')
    WHERE posts.post_type = 'tribe_events'
    AND posts.post_status = 'publish'
    AND meta.meta_value != 'once'
    AND '$queryDate 00:00:00' BETWEEN metaStartDate.meta_value AND metaRepeatsUntil.meta_value

    Is there a way to rewrite that so it can be added to the WP_Query object The Events Calendar plugin is using? Simply adding posts to the array doesn’t work because things like have_posts() and the_post() just don’t work.

    Any thoughts of how to do this without touching The Events Calendar source?

  • The topic ‘Add custom recurring events to The Events Calendar’ is closed to new replies.