Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active January 23, 2017 21:32
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/8c246686e45ade7bc69388d47de22522 to your computer and use it in GitHub Desktop.
Save Pebblo/8c246686e45ade7bc69388d47de22522 to your computer and use it in GitHub Desktop.
An example of how to alter translations using the gettext_with_context filter.
<?php //Please do not include the opening PHP tag if you already have one.
function tw_ee_gettext_with_context( $translated, $text, $context, $domain ) {
if ( 'event_espresso' == $domain ) {
if ( '(For %1$s)' == $text && '(For Event Name)' == $context ) {
$translated = '(%1$s)'; //Remove the 'For'
}
}
return $translated;
}
add_filter( 'gettext_with_context', 'tw_ee_gettext_with_context', 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment