Advertisement
Guest User

Untitled

a guest
May 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <?php
  2. //* Please do NOT include the opening php tag, except of course if you're starting with a blank file
  3.  
  4. function mycustom_filter_gettext( $translated, $original, $domain ) {
  5.  
  6. // This is an array of original strings
  7. // and what they should be replaced with
  8. $strings = array(
  9. //'Original string' => 'Translated string',
  10. 'Add to iCal Calendar' => 'Add to Calendar',
  11. // Add some more strings here
  12. );
  13.  
  14. // See if the current string is in the $strings array
  15. // If so, replace its translation
  16. if ( isset( $strings[$original] ) ) {
  17. // This accomplishes the same thing as __()
  18. // but without running it through the filter again
  19. $translations = get_translations_for_domain( $domain );
  20. $translated = $translations->translate( $strings[$original] );
  21. }
  22.  
  23. return $translated;
  24. }
  25.  
  26. add_filter( 'gettext', 'mycustom_filter_gettext', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement