Search Message "No results Found for XXX" needs to be changed

Home Forums Ticket Products Event Tickets Plus Search Message "No results Found for XXX" needs to be changed

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1133386
    James
    Participant

    Hi,

    I have found several threads asking to replace the search term when it says “There were no results found”. This is all well and good but the latest version has the search term written after this. I want the text to be replaced with something. I’ve written the function I’ve got below, I just need to know how to identify the string to replace as it involves a variable.

    If you want to see the string I want to change, go to this link – http://ssstsuk.co.uk/courses/?tribe_paged=1&tribe_event_display=list&tribe-bar-search=test

    Code I’ve got is below…

    add_filter( 'tribe_events_the_notices', 'customize_notice', 10, 2 );

    function customize_notice( $html, $notices ) {

    // If text is found in notice, then replace it
    if( stristr( $html, 'There were no results found.' ) ) {
    // Customize the message as needed
    $searchchange = str_replace( 'There were no results found.', 'Your custom notice goes here.', $searchchange );
    }

    return $searchchange;

    }

    Obviously the variable needs to be added in the first bit. Any help greatly appreciated.

    #1133774
    Josh
    Participant

    Hey James,

    Thanks for reaching out to us!

    I took a look through our files and it appears that you can update these messages by extending the Template Factory class and using modified notices there. Check out the following example, you can add that to your theme’s functions.php file and update the messages there to be whatever you would like.

    https://gist.github.com/BeardedGinger/ae7ac58500aed31651e660445f4517de

    Let me know if this helps.

    Thanks!

    #1139768
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Search Message "No results Found for XXX" needs to be changed’ is closed to new replies.