Home › Forums › Calendar Products › Events Calendar PRO › Month View – Open Event URL in New Window
- This topic has 7 replies, 3 voices, and was last updated 7 years, 10 months ago by
zafari.
-
AuthorPosts
-
May 19, 2018 at 5:01 pm #1534796
zafari
ParticipantI am now using the default Month view and have used the code snippet from this website to make the event links click to the event website URL instead of the single-event page. However, this code snippet does not give a way to open the external URL in a new window. How can I accomplish this? Thank you!
May 21, 2018 at 9:07 pm #1535685Brendan
KeymasterHi there,
Thanks for emailing support. Can you share the code snippet you are using? That way, I can see if I can modify it for the desired effect.
Thanks,
BrendanMay 22, 2018 at 10:19 am #1536273zafari
ParticipantSure! I am using this modification in functions.php:
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 );
add_filter( ‘tribe_get_event_website_link_target’, ‘blank_target_for_new_window’ );
function blank_target_for_new_window() {
return ‘_blank’;
}The code for opening the new window is the part that is not working.
Thanks, Brendan!
May 22, 2018 at 8:15 pm #1536719Brendan
KeymasterHi there,
Try switching that out with this one: https://gist.githubusercontent.com/cliffordp/3bdd3857f905c0927dc5c5594f97e319/raw/ce52639d898f3dde1b9b46a9516e983ab5a4654b/functions.php
Let me know how that goes.
Thanks,
BrendanMay 24, 2018 at 10:06 am #1538173zafari
ParticipantTried it, but still not working. Any other ideas? thanks!
May 25, 2018 at 10:50 am #1538981Jaime Marchwinski
KeymasterHi Pamela,
There are actually quite a few ways around this:
- https://wordpress.org/plugins/open-external-links-in-a-new-window/
- https://wordpress.stackexchange.com/questions/209506/how-do-i-make-images-open-in-a-new-tab-by-default
- https://wordpress.stackexchange.com/questions/230417/open-link-in-a-new-tab-checked-by-default-when-adding-a-new-link-in-visual-post
You can also try adding the following snippet to your theme’s functions.php file and see if that resolves your issue:
https://gist.github.com/cliffordp/3584b8aee70cde484700
Let us know if any of those help!
Thanks,
Jaime
May 29, 2018 at 7:05 am #1540742zafari
ParticipantThank you, Jaime!! At last something that works – #1. Thanks so much!!!!
May 29, 2018 at 8:29 pm #1541433Brendan
KeymasterGlad it worked for you!
Thanks,
BrendanJune 20, 2018 at 9:35 am #1557304Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Month View – Open Event URL in New Window’ is closed to new replies.
