-
-
Save cliffordp/82836c507db01515745db6e5172f4f76 to your computer and use it in GitHub Desktop.
<?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' ); |
Oh, so close! That first gist almost does it. It pulls in the V1 templates, instead of the V2.
I haven't figured out a way to use a widget, as I'm creating a customized version of "Featured Events" based on a query variable for an organizer. The organizers are embedding a community calendar on their site, and we are "Featuring" their next two events just for them.
I hit enter too soon, then GitHub went down for a short bit... I just now updated my previous reply.
Beyond what I've shared here, you'll have to continue on your own, especially with the custom scenario you're working within.
Good luck!
One of your colleges sent this and I'm set:
$engine = new \Tribe__Template(); $engine->set_template_origin( tribe( 'tec.main' ) ) ->set_template_folder( 'src/views/v2' ) ->set_template_folder_lookup( true ) ->set_template_context_extract( true );
Then I'm using it like this with the results of a query:
$engine->template( 'list/event', [ 'event' => tribe_get_event( $event->ID ) ] );
👍
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!
🥳
@benklocek, if you have Events Calendar Pro, you could just use a shortcode: https://theeventscalendar.com/knowledgebase/k/events-calendar-pro-widget-shortcodes-overview/
But since you're trying to integrate to a third-party thing, these might help accomplish whatever you're doing: