Skip to content

Instantly share code, notes, and snippets.

@GeoffEW
Last active October 19, 2020 19:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeoffEW/8c94dbcd36332525e4b42a7d74378596 to your computer and use it in GitHub Desktop.
Save GeoffEW/8c94dbcd36332525e4b42a7d74378596 to your computer and use it in GitHub Desktop.
change_ticket_in_email.php
<?php
function tribe_custom_theme_text ( $translation, $text, $domain ) {
// Put your custom text here in a key => value pair
// Example: 'Text you want to change' => 'This is what it will be changed to'
// The text you want to change is the key, and it is case-sensitive
// The text you want to change it to is the value
// You can freely add or remove key => values, but make sure to separate them with a comma
// This example changes the label "Venue" to "Location", and "Related Events" to "Similar Events"
$custom_text = array(
'Ticket #' => 'Event #',
'Ticket Type' => 'Event Type',
'Your tickets from %s' => 'Your events from %s',
'Your tickets from {site_title}' => 'Your events from {site_title}',
'View your %s' => 'View your events',
'%d Ticket' => '%d Event',
'%d Tickets' => '%d Events',
'Ticket' => 'Event'
);
// If this text domain starts with "tribe-", "the-events-", or "event-" and we have replacement text
if( (strpos($domain, 'tribe-') === 0 || strpos($domain, 'the-events-') === 0 || strpos($domain, 'event-') === 0) && array_key_exists($translation, $custom_text) ) {
$translation = $custom_text[$translation];
}
return $translation;
}
add_filter('gettext', 'tribe_custom_theme_text', 20, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment