Skip to content

Instantly share code, notes, and snippets.

@GeoffEW
Last active October 2, 2022 15:15
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeoffEW/b8f0bb5fc2b8510c6ad4f0b60fcf3fb9 to your computer and use it in GitHub Desktop.
Save GeoffEW/b8f0bb5fc2b8510c6ad4f0b60fcf3fb9 to your computer and use it in GitHub Desktop.
Prevent calendar export links from showing anywhere on the front-end.
<?php
/**
* Prevent calendar export links from showing anywhere on the front-end.
*
*
*/
class Tribe__Events__Remove__Export__Links {
public function __construct() {
add_action( 'init', array( $this, 'single_event_links' ) );
add_action( 'init', array( $this, 'view_links' ) );
}
public function single_event_links() {
remove_action(
'tribe_events_single_event_after_the_content',
array( $this->ical_provider(), 'single_event_links' )
);
}
public function view_links() {
remove_filter(
'tribe_events_after_footer',
array( $this->ical_provider(), 'maybe_add_link' )
);
}
protected function ical_provider() {
return function_exists( 'tribe' )
? tribe( 'tec.iCal' ) // Current
: 'Tribe__Events__iCal'; // Legacy
}
}
new Tribe__Events__Remove__Export__Links();
@wpfangirl
Copy link

Thanks for posting this! I've created a modified version that repositions the links below the event meta on single pages, rather than removing them: https://gist.github.com/wpfangirl/757530009da54e50ae52748eaaace5f6.

@burkeingraffia
Copy link

Should this work on TEC 6.0+?

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