Past events are shown, I'd like them hidden from the main Events page & widget

Home Forums Calendar Products Events Calendar PRO Past events are shown, I'd like them hidden from the main Events page & widget

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1473332
    marcel_perform
    Participant

    I created a recurring event. Some of the events have already happened, but they appear on the main Events page, as well as the widget.

    How do I hide past events?

    #1474658
    Sky
    Keymaster

    Hi Marcel!

    To hide past events from showing in the calendar, you can add a couple of snippets.

    First, add this to your theme or child theme’s functions.php file:

    add_filter( 'post_class', 'tribe_events_add_past_class_to_events', 10, 3 );
    function tribe_events_add_past_class_to_events( $classes, $class, $post_id ) {
    if ( ! is_array( $classes ) ) {
    return $classes;
    }
    if ( ! tribe_is_event( $post_id ) ) {
    return $classes;
    }
    if ( tribe_is_past_event( $post_id ) ) {
    $classes[] = 'tribe-events--is-past-event';
    }
    return $classes;
    }

    Then, in your CSS, add this:

    .type-tribe_events .tribe-events--is-past-event {
    display: none !important;
    }

    Let me know if that helps!

    Thanks,
    Sky

    #1493568
    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 ‘Past events are shown, I'd like them hidden from the main Events page & widget’ is closed to new replies.