Hide Previous Events

Home Forums Calendar Products Events Calendar PRO Hide Previous Events

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1629490
    Rich
    Participant

    How can we hide events that have already passed? I see option for deleting after 3 months. We want to hide events in the past.

    #1631289
    Sky
    Keymaster

    Hi there,

    Thanks for reaching out. I’d be happy to help with your question.

    This can be done with some customization.

    First, add the following to your theme’s functions.php:

    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;
    }

    Once that is done, add this CSS either in the customizer or in your theme’s CSS file:


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

    Hope that helps! Please let me know if that works for you, or if you have any other questions.

    Regards,
    Sky

    #1644931
    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 ‘Hide Previous Events’ is closed to new replies.