{"id":108,"date":"2016-05-29T21:18:49","date_gmt":"2016-05-29T21:18:49","guid":{"rendered":"https:\/\/wiki.samuelchopard.ch\/?p=108"},"modified":"2019-03-18T14:29:28","modified_gmt":"2019-03-18T13:29:28","slug":"quickly-translate-or-replace-text","status":"publish","type":"post","link":"https:\/\/samuelchopard.ch\/wiki\/library\/quickly-translate-or-replace-text\/","title":{"rendered":"Quickly translate or replace text"},"content":{"rendered":"<p><!--more--><\/p>\n<pre class=\"EnlighterJSRAW\">add_filter('gettext', 'translate_text');\nadd_filter('ngettext', 'translate_text');\n\nfunction translate_text($translated) {\n$translated = str_ireplace('Choose an option', 'Select', $translated);\n$translated = str_ireplace('Original Text', 'Your Replacment Text', $translated);\nreturn $translated;\n}<\/pre>\n<p>&nbsp;<br \/>\n<strong>Note:<\/strong> if the text you are trying to change is not translatable ie. not wrapped in a __( or _e( within the theme files this technique will not work on that text.<\/p>\n<p>Source: <a target=\"_blank\" href=\"https:\/\/support.woothemes.com\/hc\/en-us\/articles\/203105817-Quickly-Translate-Or-Replace-WordPress-Localized-Site-Text\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/support.woothemes.com\/hc\/en-us\/articles\/203105817-Quickly-Translate-Or-Replace-WordPress-Localized-Site-Text<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"add_filter('gettext', 'translate_text'); add_filter('ngettext', 'translate_text'); function translate_text($translated) { $translated = str_ireplace('Choose an option', 'Select', $translated); $translated = str_ireplace('Original Text', 'Your Replacment [...]","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[217,290,295,302],"class_list":["post-108","post","type-post","status-publish","format-standard","hentry","category-php-tricks","tag-plugin","tag-text","tag-theme","tag-translate"],"_links":{"self":[{"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":1,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":54935,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/posts\/108\/revisions\/54935"}],"wp:attachment":[{"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}