Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created April 26, 2016 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/a67a0e120872fc571ab286e1550dea30 to your computer and use it in GitHub Desktop.
Save Pebblo/a67a0e120872fc571ab286e1550dea30 to your computer and use it in GitHub Desktop.
This changes 'Goes on sale' within the ticket selector to 'Price Increases'
<?php
//Do not include the opening PHP tag if you already have one.
function mike_mycustom_filter_gettext( $translated, $original, $domain ) {
// This is an array of original strings
// and what they should be replaced with
$strings = array(
'Goes&nbsp;On&nbsp;Sale' => 'Price Increases',
// Add some more strings here
);
// See if the current string is in the $strings array
// If so, replace its translation
if ( isset( $strings[$original] ) ) {
// This accomplishes the same thing as __()
// but without running it through the filter again
$translations = get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}
return $translated;
}
add_filter( 'gettext', 'mike_mycustom_filter_gettext', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment