eventsmanager

Translate Text using gettext filter/hook

Apr 12th, 2015 (edited)
1,035
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Translate Text using gettext filter/hook
  3.  * As for where to paste this : http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/
  4.  */
  5. function change_label( $translated_text, $text, $domain ) {
  6.         switch ( $translated_text ) {
  7.             case 'Apply Discount' :
  8.                 $translated_text = 'Gutscheincode;
  9.                break;
  10.        }
  11.    return $translated_text;
  12. }
  13. add_filter( 'gettext', 'change_label', 20, 3 );
RAW Paste Data