Change search results wording

Home Forums Calendar Products Events Calendar PRO Change search results wording

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1211250
    Rami
    Participant

    Hi – I have EC Pro
    I am trying to alter the wording of search results…specifically when no results are found.

    I went through a number of theme files looking for the location of the text string, “There were no results found for: and I couldn’t not find this file.

    Any suggestions on the location of this file and the best way to alter the message?

    thanks,
    Jake

    #1211331
    Nico
    Member

    Hi there Jake,

    Thanks for getting in touch with us!

    To change the wording of that phrase (or any in the plugin), you’ll need to override the original string. Just paste the snippet below in your theme’s (or child theme’s) functions.php file and it will do the trick for you:


    /* Tribe, replace custom strings */
    function tribe_custom_theme_text ( $translation, $text, $domain ) {

    $custom_text = array(
    'There were no results found for %s.' => 'No results found for %s.',
    );

    if( (strpos($domain, 'tribe-') === 0 || strpos($domain, 'the-events-') === 0 || strpos($domain, 'event-') === 0) && array_key_exists($translation, $custom_text) ) {
    $translation = $custom_text[$translation];
    }

    return $translation;
    }
    add_filter('gettext', 'tribe_custom_theme_text', 20, 3);

    You can find more details on this snippet here → Change the wording of any bit of text or string

    Please let me know if this helps,
    Best,
    Nico

    #1212216
    Rami
    Participant

    Hi Nico – thanks for the suggestions, however I had some issues trying to implement the code you suggested.

    I already have a functions.php file in my child theme

    I pasted in your code in several locations in that file:
    Before the <?php
    After the <?php
    Before the ?>
    After the ?>
    I also created another version of the <?php (code) ?>
    In all cases, it crashed the site and I had to restore the original functions.php to set the site right again.

    I am not much of a php expert, so any assistance you can offer will be appreciated. Thanks, Jake

    #1212308
    Nico
    Member

    Thanks for following up Jake!

    The code should be placed before the ?> (which by the way is not needed in this file). But I think the error might be from copying-pasting the code from the forum post directly. Try copying it from the embed below (and if you still got errors, try pasting it first in a plain text editor and then copy it over to the functions file):

    https://gist.github.com/niconerd/e787157ca143faf4a91dacbd812ce6fe

    Please let me know if that works,
    Best,
    Nico

    #1212408
    Rami
    Participant

    Hi Nico – success
    I had to tweak a little, but it worked out.
    Thanks again
    Jake

    #1212507
    Nico
    Member

    Stoked to hear Jake 🙂

    I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.

    Best,
    Nico

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Change search results wording’ is closed to new replies.