-
-
Save theeventscalendar/632a24421c22fcab9b3f to your computer and use it in GitHub Desktop.
Change event or venue links in The Events Calendar to the relevant website URL
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 event website URL if that is set. | |
* NOTE: Comment out the add_filter() line to disable this function. | |
*/ | |
function tribe_set_link_website ( $link, $postId ) { | |
$website_url = tribe_get_event_website_url( $postId ); | |
// Only swaps link if set | |
if ( !empty( $website_url ) ) { | |
$link = $website_url; | |
} | |
return $link; | |
} | |
add_filter( 'tribe_get_event_link', 'tribe_set_link_website', 100, 2 ); |
Don't include the initial <?php
if you're adding it to your theme's functions.php file, since it's already at the top of that file.
Any ideas on how to get the links to open in a new window?
This doesn't seem to work on the calendar view for some reason.
Edit: Seems like tribe_set_link_website
isn't called on the calendar.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just tried this, putting the code at the very end of the functions.php file. I put it at the end because the instructions do not note where to put it. Immediately upon saving, I got the code:
Parse error: syntax error, unexpected '<' in /home/madelinefay1818/public_html/psychicawakeningsseattle/wp-content/themes/Divi/functions.php on line 8039
I'm using WordPress 4.3.1 running Divi theme Version: 2.5.3.
Anybody got any thoughts on how to make this work?