Last active
July 3, 2023 23:50
-
-
Save barryhughes/ed85c6985041679027ce to your computer and use it in GitHub Desktop.
Add to a custom plugin file or your theme's functions.php file to convert organizer email addresses to live, clickable links
This file contains hidden or 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
/** | |
* Convert organizer emails into live "mailto:" links that users can click on. | |
* | |
* @param $email | |
* @return string | |
*/ | |
function organizer_live_email_link( $email ) { | |
if ( ! is_email( $email ) || ! is_singular( Tribe__Events__Main::POSTTYPE ) ) return $email; | |
return '<a href="mailto:' . esc_attr( $email ) . '">' . esc_html( $email ) . '</a>'; | |
} | |
add_filter( 'tribe_get_organizer_email', 'organizer_live_email_link' ); |
Revised: it only transforms the organizer email address within single event pages. In the case of single organizer pages, this transformation was already happening (which resulted in the noted problem).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Barry
This works great on the single event meta email address, making the email LIVE - but has an odd result on the actual ORGANIZERS single page
The organizer details should look like this:
telephone number | email | website
instead this is the result:
telephone number | email">email | website
Is there a fix?