Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Last active May 22, 2020 21:10
Show Gist options
  • Save cliffordp/82836c507db01515745db6e5172f4f76 to your computer and use it in GitHub Desktop.
Save cliffordp/82836c507db01515745db6e5172f4f76 to your computer and use it in GitHub Desktop.
The Events Calendar (V2 Views): Remove the "This event has passed." notice from single events.
<?php
/**
* The Events Calendar (V2 Views): Remove the "This event has passed." notice from single events.
*
* FYI: There are other places this same notice displays, such as embed view. To remove the notice from everywhere,
* remove the code snippet's "if..." logic.
*
* @link https://gist.github.com/cliffordp/82836c507db01515745db6e5172f4f76 This snippet.
* @link https://share.getcloudapp.com/YEud5m7d Screenshot of the notice that gets removed.
*/
function tec_remove_is_a_past_event_notice_on_event_single() {
/** @var \Tribe\Events\Views\V2\Template_Bootstrap $template */
$template = tribe( \Tribe\Events\Views\V2\Template_Bootstrap::class );
if ( $template->is_single_event() ) {
Tribe__Notices::remove_notice( 'event-past' );
}
}
add_action( 'tribe_pre_get_view', 'tec_remove_is_a_past_event_notice_on_event_single' );
@cliffordp
Copy link
Author

👍

@benklocek
Copy link

Yeah! That does the trick. Thank you, Clifford!

Thanks also for pointing me to the /tribe-ext-events-happening-now plugin. There is lots there for me to work with.

I love you guys!

@cliffordp
Copy link
Author

🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment