Home › Forums › Calendar Products › Events Calendar PRO › Change search results wording
- This topic has 6 replies, 3 voices, and was last updated 9 years, 4 months ago by
Rami.
-
AuthorPosts
-
December 28, 2016 at 6:40 pm #1211250
Rami
ParticipantHi – 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,
JakeDecember 29, 2016 at 7:40 am #1211331Nico
MemberHi 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,
NicoJanuary 2, 2017 at 1:42 am #1212216Rami
ParticipantHi 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
January 2, 2017 at 10:28 am #1212308Nico
MemberThanks 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,
NicoJanuary 2, 2017 at 8:49 pm #1212408Rami
ParticipantHi Nico – success
I had to tweak a little, but it worked out.
Thanks again
JakeJanuary 3, 2017 at 6:56 am #1212507Nico
MemberStoked 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 -
AuthorPosts
- The topic ‘Change search results wording’ is closed to new replies.
