Opening the event website url in a new tab/window
-
Hello,
I am using this snippet (found here) to make events go to straight to the event website url:
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 );
Works great.
I’d also like that url to open in a new tab/page as (discussed here), where the following code is offered:
add_filter( 'tribe_get_event_website_link_target', 'blank_target_for_new_window' ); function blank_target_for_new_window() { return '_blank'; }
This on its own works fine, but since the first snippet above bypasses the single event view by redirecting to the event website url, understandably it doesn’t work when combined with the first snippet.
I’ve tried modifying the latter snippet (the one to open in a new tab/window) every which way I can think of to play nicely with the former (redirecting to the event website url), with no luck. It seems there should be an easy enough solution; obviously I’m missing something.
Anyone have any ideas/suggestions?
- The topic ‘Opening the event website url in a new tab/window’ is closed to new replies.