Skip to content

Instantly share code, notes, and snippets.

@barryhughes
Last active July 3, 2023 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save barryhughes/ed85c6985041679027ce to your computer and use it in GitHub Desktop.
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
/**
* 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' );
@hophead
Copy link

hophead commented Apr 21, 2015

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?

@barryhughes
Copy link
Author

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