Filter recurring events shown on Display All page

Home Forums Calendar Products Events Calendar PRO Filter recurring events shown on Display All page

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1285291
    Ryan
    Participant

    When viewing the /all page for a Recurring Event, the page shows all existing events in the series starting with oldest to newest. We have the “Clean up recurring events after” setting set to 6 months, so the /all page includes up to 6 months of past events before showing the current & future events in the series.

    Is there a simple way to filter this page to show only current & future events, while still preserving the 6 months of history for search purposes?

    Thanks!

    #1286545
    Jennifer
    Keymaster

    Hi Adam!

    Sorry for the delayed reply – our forums have been a bit busier than usual!

    Try adding this to your functions.php file:

    function tribe_recurring_events_view_all_filter( WP_Query $query ) {
    if ( $query->is_main_query() && 'all' === $query->get( 'eventDisplay' ) ) {
    $query->set( 'start_date', date_i18n( Tribe__Date_Utils::DBDATETIMEFORMAT ) );
    $query->set( 'tribe_remove_date_filters', false );
    }

    return $query;

    }

    add_action( 'tribe_events_pre_get_posts', 'tribe_recurring_events_view_all_filter', 100 );

    That should give you only the upcoming events on the “see all” page.

    Let me know how it works for you!

    Thanks,

    Jennifer

    #1296211
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Filter recurring events shown on Display All page’ is closed to new replies.