Skip to content

Instantly share code, notes, and snippets.

@janzikmund
Last active April 21, 2018 09:21
Show Gist options
  • Save janzikmund/5c1a0287f664aff69c3eedc247ab8a88 to your computer and use it in GitHub Desktop.
Save janzikmund/5c1a0287f664aff69c3eedc247ab8a88 to your computer and use it in GitHub Desktop.
WordPress gettext filter
<?php
// custom text translations
add_filter( 'gettext', function( $translated_text, $text, $domain ) {
$translations = array(
'qode' => array(
'view' => 'read more',
),
'wpgmp_google_map' => array(
'Enter address or latitude or longitude or title or city or state or country or postal code here...' => 'Suburb, Town, City'
),
);
if ( isset($translations[$domain][$translated_text]) ) {
return $translations[$domain][$translated_text];
}
return $translated_text;
}, 20, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment