daymobrew

Change string without using str_ireplace()

Nov 12th, 2014
376
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. // Suggested code in response to:
  4. // http://speakinginbytes.com/2013/10/gettext-filter-wordpress/#comment-52566
  5.  
  6. add_filter('gettext', 'translate_text', 10, 3);
  7. add_filter('ngettext', 'translate_text', 10, 3);
  8.  
  9. function translate_text($translated, $text, $domain) {
  10.   if ('Ship to a different address?' == $translated) {
  11.      return 'Deliver to a different address?';
  12.   }
  13.   return $translated;
  14. }
RAW Paste Data