Skip to content

Instantly share code, notes, and snippets.

@theeventscalendar
Forked from barryhughes/EventWebsiteLink.php
Last active December 28, 2020 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theeventscalendar/aacd642414ed838aecb7 to your computer and use it in GitHub Desktop.
Save theeventscalendar/aacd642414ed838aecb7 to your computer and use it in GitHub Desktop.
Make an Event Website a link instead of showing the text url. This version opens a new window with the additional target=blank code.
<?php
add_filter( 'tribe_get_event_website_link_label', 'tribe_get_event_website_link_label_default' );
function tribe_get_event_website_link_label_default( $label ) {
if ( $label === tribe_get_event_website_url() ) {
$label = "Visit Website &raquo;";
}
return '<a href="' . tribe_get_event_website_url() . '" target="_blank">' . $label . '</a>';
}
@jordanpwebdev
Copy link

This is outdated. I had to use this method to make the link open in a new window/tab:

add_filter( 'tribe_get_event_website_link_target', function() { return '_blank'; } );

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