Skip to content

Instantly share code, notes, and snippets.

@BeardedGinger
Created January 7, 2016 21:46
Show Gist options
  • Save BeardedGinger/7bd2fd310c28cd9899f6 to your computer and use it in GitHub Desktop.
Save BeardedGinger/7bd2fd310c28cd9899f6 to your computer and use it in GitHub Desktop.
/*
* EXAMPLE OF CHANGING ANY TEXT (STRING) IN THE EVENTS CALENDAR
* See the codex to learn more about WP text domains:
* http://codex.wordpress.org/Translating_WordPress#Localization_Technology
* Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'...
*/
function tribe_custom_theme_text ( $translations, $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(
'Tickets' => 'Admit Card',
'Related %s' => 'Similar %s',
);
// If this text domain starts with "tribe-", and we have replacement text
if(strpos($domain, 'event-') === 0 && array_key_exists($text, $custom_text) ) {
$text = $custom_text[$text];
}
return $text;
}
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