Last active
April 6, 2023 13:11
-
-
Save cliffordp/3584b8aee70cde484700 to your computer and use it in GitHub Desktop.
Open Event Website, Organizer, and Venue links in new window
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 | |
/** | |
* The Events Calendar: Open event website, organizer, and venue links in new window. | |
* | |
* Filters are found in these files: | |
* /wp-content/plugins/the-events-calendar/src/functions/template-tags/link.php | |
* /wp-content/plugins/events-calendar-pro/src/functions/template-tags/general.php | |
* /wp-content/plugins/the-events-calendar/src/functions/template-tags/organizer.php | |
* /wp-content/plugins/the-events-calendar/src/functions/template-tags/venue.php | |
* | |
* @link https://gist.github.com/cliffordp/3584b8aee70cde484700 | |
* | |
* @return string | |
*/ | |
add_filter( 'tribe_get_event_website_link_target', 'cliff_blank_target_for_new_window' ); | |
add_filter( 'tribe_get_organizer_website_link_target', 'cliff_blank_target_for_new_window' ); | |
add_filter( 'tribe_get_venue_website_link_target', 'cliff_blank_target_for_new_window' ); | |
function cliff_blank_target_for_new_window() { | |
return '_blank'; | |
} |
Thanks for sharing.
Those tips are part of that Knowledgebase article :)
Thanks, still works!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This does not work for the organizer link (at least not as of right now). According to
/wp-content/plugins/the-events-calendar/src/functions/template-tags/organizer.php
it is 'tribe_get_event_organizer_link_target'
instead of 'tribe_get_organizer_website_link_target'
For those wondering where to put this code:
Put it in the functions.php of your theme. To avoid it being overwritten by theme updates create a child theme, see: https://developer.wordpress.org/themes/advanced-topics/child-themes/
There are also several wordpress plugins which allow you to add code simply via the wp dashboard.