Home › Forums › Additional Help › Translations › Changing tribe-events-notices
- This topic has 4 replies, 1 voice, and was last updated 8 years ago by Brian.
-
AuthorPosts
-
May 3, 2016 at 4:48 pm #1110242Jeramiah YoungGuest
I have tried changing the notice “There were no results found.” using the code from the related thread below and putting that into my theme’s functions.php file:
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
$html = str_replace( 'There were no results found.', 'We are continually working to add additional dates and/or locations for upcoming markets. Be sure to check back for additional event dates & details!', $html );
}return $html;
}
Unfortunately this code does not work. Any ideas how I can change the language of that?
RELATED THREAD: https://theeventscalendar.com/support/forums/topic/change-the-text-for-tribe_events_the_notices-on-events-that-have-passed/
May 3, 2016 at 6:20 pm #1110262Jeramiah YoungGuestI also found this thread https://theeventscalendar.com/support/forums/topic/there-were-no-results-found-to-there-were-no-results-found-see-next-month/
as reported by the client, this code does not work either.
/*
* Change No results Found Message
* @version 3.9
*
*/
add_filter('gettext', 'tec_filter_translations', 10, 3);
function tec_filter_translations($translations, $text, $domain) {
if ($domain == 'tribe-events-calendar') {$text = str_ireplace( 'There were no results found.', 'There were no results found-see next month', $text );
}
return $text;
}
May 3, 2016 at 6:39 pm #1110269Jeramiah YoungGuestIt might be useful to note that I’m using the Pro version – so maybe it’s different?
May 3, 2016 at 8:30 pm #1110302Jeramiah YoungGuestOk this code, you supplied in another article worked.
function tribe_custom_theme_text ( $translations, $text, $domain ) {// Put your custom text here in a key => value pair
// Example: 'Text you want to change' => 'This is what it will be changed to'
// The text you want to change is the key, and it is case-sensitive
// The text you want to change it to is the value
// You can freely add or remove key => values, but make sure to separate them with a comma
// This example changes the label "Venue" to "Location", and "Related Events" to "Similar Events"
$custom_text = array(
'There were no results found.' => 'We are continually working to add additional dates and/or locations. Be sure to check back for additional event dates & details!',);
// If this text domain starts with "tribe-" or "the-events-", and we have replacement text
if((strpos($domain, 'tribe-') === 0 || strpos($domain, 'the-events-') === 0) && array_key_exists($text, $custom_text) ) {
$text = $custom_text[$text];
}return $text;
}
add_filter('gettext', 'tribe_custom_theme_text', 20, 3);
May 4, 2016 at 4:46 am #1110370BrianKeymasterHi,
Thanks for using the Events Calendar.
Glad you found a solution.
In the future here on the pre-sales forum, I’m afraid we do not provide technical support.
Please post in the premium forums to get support for Pro and other premium plugins.
Since this is marked resolved I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic on the forum and we can help you out.
Thanks
-
AuthorPosts
- The topic ‘Changing tribe-events-notices’ is closed to new replies.