Skip to content

Instantly share code, notes, and snippets.

@GeoffEW GeoffEW/prevent_export.php
Last active Apr 18, 2018

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

wpfangirl commented Apr 18, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.