{"id":927,"date":"2025-03-24T14:28:03","date_gmt":"2025-03-24T14:28:03","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/how-to-change-just-one-language-string\/"},"modified":"2025-04-03T15:24:23","modified_gmt":"2025-04-03T14:24:23","slug":"how-to-change-just-one-language-string","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/translations\/how-to-change-just-one-language-string\/","title":{"rendered":"How to change just one language string"},"content":{"rendered":"\n<div class=\"wp-block-blockstrap-blockstrap-widget-alert d-flex align-items-center fade show alert alert-info mb-3\" role=\"alert\"><span class=\"fas fa-info-circle me-2\"><\/span><span class=\"flex-grow-1\">If you only want to <strong>change one language string<\/strong>, you can add a PHP code snippet, instead of <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/how-to-translate-or-localize-geodirectory\/\">creating or editing language files<\/a>. We recommend using the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/useful-plugins\/code-snippets-plugin\/\">Code Snippets plugin<\/a>.<\/span><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">You will need:<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>text domain: <\/strong>this is usually the file name of the language file, for example <strong>geodirectory,\u00a0geodirlocation<\/strong>\u00a0etc<figure><img loading=\"lazy\" decoding=\"async\" width=\"241\" height=\"200\" class=\"attachment-large size-large\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-Gp9C3RUV92.png\" alt=\"\"><\/figure><\/li>\n\n\n\n<li><strong>exact default string:<\/strong> it is best to copy this direct from the language file in the .po file in the language file<figure><img loading=\"lazy\" decoding=\"async\" sizes=\"auto, (max-width: 381px) 100vw, 381px\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-fvbX3dwDBQ.png 381w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-fvbX3dwDBQ-300x91.png 300w\" width=\"381\" height=\"116\" class=\"attachment-large size-large\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-fvbX3dwDBQ.png\" alt=\"\"><\/figure><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Example code snippet 1<\/h2>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">add_filter( &#039;gettext&#039;, &#039;_my_string_changes&#039;, 10, 3);\nfunction _my_string_changes($translation, $text, $domain ){\n\tif( $domain == &#039;geodirectory&#039; &amp;&amp; $text == &#039;Post received, your listing may need to be reviewed before going live, you can preview it %shere%s.&#039; ){\n\t\t$translation = &#039;Thanks for adding a listing this will be approved within 24 hours.&#039;;\n\t}\n\treturn $translation;\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Example code snippet 2<\/h2>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">add_filter( &#039;gettext&#039;, &#039;_my_string_changes&#039;, 10, 3);\nfunction _my_string_changes($translation, $text, $domain ){\n\tif( $domain == &#039;geodirlocation&#039; &amp;&amp; $text == &#039;Click on above field and type to filter list or add a new city.&#039; ){\n\t\t$translation = &#039;Select a city or town.&#039;;\n\t}\n\treturn $translation;\n}\n<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You will need: Example code snippet 1 Example code snippet 2<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[211,433,434],"class_list":["post-927","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-tips-tricks-more","gd_placecategory-code-snippets","gd_placecategory-translations"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/927","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=927"}],"version-history":[{"count":0,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/927\/revisions"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=927"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=927"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}