Created
September 24, 2018 15:07
-
-
Save skyshab/d5c063f32ef3d95359082a542555a3bd to your computer and use it in GitHub Desktop.
Redirect event links to Eventbrite.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This changes the event link to the Eventbrite URL if that is set. | |
*/ | |
add_filter( 'tribe_get_event_link', 'my_set_eb_link', 100, 2 ); | |
function my_set_eb_link ( $link, $postId ) { | |
$eventbrite_id = get_post_meta( $postId, '_EventBriteId', true ); | |
// Only swaps link if set | |
if ( !empty( $eventbrite_id ) ) { | |
$link = 'https://www.eventbrite.com/edit?eid=' . $eventbrite_id; | |
} | |
return $link; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment