• Resolved spinach

    (@oonaghstaerckdesign)


    Hello,

    How do I customise or remove the message which appears when no results are found?

    Many thanks!

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support alexrollin

    (@alexrollin)

    Hello!

    You can do that by translating the plugin.

    You can find our instructions on how to do that here.

    https://docs.wpgeodirectory.com/article/97-how-to-translate-or-localize-geodirectory

    Thread Starter spinach

    (@oonaghstaerckdesign)

    Hey Alex,

    Sorry I’m a little confused. I’m not looking to change the language of the plugin, I just want to change the text which appears in the blue box which appears on the map widget and reads:

    “No Records Found. Sorry, no records were found. Please adjust your search criteria and try again.”

    Equally, I would be just as happy to remove the blue box entirely.

    Many thanks for your response!

    Plugin Support alexrollin

    (@alexrollin)

    Hi!

    The process of localization works the same as translation to another language almost, but not quite.

    If your site is in us_en for example, you just need to change the translation to something else, as opposed to saving the file to a different language set like fr.

    There are quite a few plugins out there to help with this, but, we have found that the easiest is to use POEdit – plus, once you change one string, you will probably find lots of others that would be nice to change, too.

    Plugin Author Paolo

    (@paoltaia)

    Just FYI, there is another option via code snippet.

    https://docs.wpgeodirectory.com/article/259-how-to-change-just-one-language-string

    Thanks,

    Thread Starter spinach

    (@oonaghstaerckdesign)

    Hey @paoltaia

    Thanks for responding.

    I have tried to update it this way using the following code in my functions.php files in my child theme but it’s not changed anything. Can you see anything wrong in the code?

    `add_filter( ‘gettext’, ‘_my_string_changes’, 10, 3);
    function _my_string_changes($translation, $text, $domain ){
    if( $domain == ‘geodirectory’ && $text == ‘<h3>No Records Found</h3><p>Sorry, no records were found. Please adjust your search criteria and try again.</p>’ ){
    $translation = ‘<h3>No Florists Found</h3><p>Sorry, no florists were found in this area.</p>’;
    }
    return $translation;
    }`

    Plugin Author Paolo

    (@paoltaia)

    It looks like you have 2 extra apostrophes at the start and at the end.

    Also, make sure all other apostrophes used are this ' and not `.

    Let me know if that was it.

    • This reply was modified 2 years, 9 months ago by Paolo.
    • This reply was modified 2 years, 9 months ago by Paolo.
    Thread Starter spinach

    (@oonaghstaerckdesign)

    Hey @paoltaia

    Sorry, no I added those. It was meant to format it as code in the comment but it didn’t seem to work. Those ` apostrophes are not included in the code.

    Plugin Author Paolo

    (@paoltaia)

    What about the apostrophes in the code, did you check those?

    Thread Starter spinach

    (@oonaghstaerckdesign)

    Yes, I copy and pasted from your article. All ‘ are ‘ in the code.

    I have screenshotted it and attached below.

    View post on imgur.com

    Plugin Author Paolo

    (@paoltaia)

    I just double-checked, you are not using the right text string.

    Use this instead:

    add_filter( 'gettext', '_my_string_changes', 10, 3);
    function _my_string_changes($translation, $text, $domain ){
    if( $domain == 'geodirectory' && $text == '%sNo Records Found%s Sorry, no records were found. Please adjust your search criteria and try again.%s' ){
    $translation = '%sNo Florists Found%s Sorry, no florists were found in this area.%s';
    }
    return $translation;
    }

    I tested it and it works.

    Thanks,

    Thread Starter spinach

    (@oonaghstaerckdesign)

    Perfect, that works for me too – thanks so much for your help!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Customise ‘No Records Found’ message and look on Maps Widget’ is closed to new replies.