Skip to content

Instantly share code, notes, and snippets.

@barryhughes
Last active July 3, 2023 23:50
Show Gist options
  • 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' );
@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