Hey @sebastien,
I would recommend a slightly different course of action here.
First, instead of the snippet shared above, add this code snippet to your 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;
}
Once that is done, add this CSS to the bottom of your theme’s style.css file:
.type-tribe_events .tribe-events--is-past-event {
display: none !important;
}
This works well for me and totally hides any past event from your site…let me know if it helps! 😀
— George