Home › Forums › Calendar Products › Events Calendar PRO › Title "Events" randomly gone back to default
- This topic has 5 replies, 2 voices, and was last updated 11 years, 3 months ago by
Geoff.
-
AuthorPosts
-
January 20, 2015 at 4:36 am #935117
Carl
ParticipantHello,
The other week I changed the title of “events” to “courses” using the following code:
// This example replaces “Event” with “Course” in all Tribe Plugins text
// See the codex to learn more about WP text domains:
// http://codex.wordpress.org/Translating_WordPress#Localization_Technology
// Example Tribe domains: ‘tribe-events-calendar’, ‘tribe-events-calendar-pro’…add_filter(‘gettext’, ‘theme_filter_text’, 10, 3);
function theme_filter_text( $translations, $text, $domain ) {
// If this text domain starts with “tribe-”
if(strpos($domain, ‘tribe-‘) === 0) {
// Replace upper case, lower case, singular, and plural
$text = str_replace(
// Text to search for
array(‘Event’, ‘event’, ‘Events’, ‘events’),// Text to replace it with — change this for your needs
array(‘Course’, ‘course’, ‘Courses’, ‘courses’),
$text
);}
return $text;
}add_filter(‘ngettext’, ‘theme_filter_ntext’, 10, 5);
function theme_filter_ntext( $translation, $single, $plural, $number, $domain ) {
// If this text domain starts with “tribe-”
if(strpos($domain, ‘tribe-‘) === 0) {
// Replace upper case, lower case, singular, and plural
if( $number > 1 ) {
$plural = str_replace(
// Text to search for
array(‘Events’, ‘events’),// Text to replace it with — change this for your needs
array(‘Courses’, ‘courses’),
$plural
);return $plural;
} else {
$single = str_replace(
// Text to search for
array(‘Event’, ‘event’),// Text to replace it with — change this for your needs
array(‘Course’, ‘course’),
$single
);return $single;
}
}
}Everything went fine until I logged in yesterday and it had mysteriously gone back to “event”. Do you know why this is?
Thanks
January 20, 2015 at 8:29 am #935226Geoff
MemberHi there, Carl! Thanks for getting in touch and sorry you’re hitting some trouble here with the snippet you were using.
That’s certainly odd. It’s tough to pinpoint why exactly that would happen, but it could be for a number of reasons like plugin updates, theme changes, revisions to code, just to name a few.
Either way, I just tried the snippet from this tutorial and it looks like it does the trick. Of course, you will want to change “Meetings” to “Courses” but it should get you back on track. 🙂
Cheers!
GeoffJanuary 20, 2015 at 8:35 am #935231Carl
ParticipantHi Geoff, I have a feeling it may be something to do with updating a plugin, even though the php code is still there.
I just put this into the functions.php and it still didn’t work for some reason.
January 20, 2015 at 8:50 am #935243Geoff
MemberIt’s tough to tell, but I wonder if one of three things is happening:
1) Conflict with another plugin. Perhaps try our  Testing for Conflicts Guide to see if a conflict exists and, if so, where it’s happening.
<b>2) Placement of the snippet.</b> It’s possible that the snippet simply needs to be moved to another location in the file. Normally, it can go at the very bottom of the file. You can also try placing right after the opening “<?php” tag at the top of the file to ensure it’s not getting tangled up in another function.
3) Plugin versions. Are you using the latest version of The Events Calendar (3.9.1) and WooTickets (3.9)? Make sure those are up to date and see if there’s a difference.
Also, if you know which plugin(s) you’re recently updated, try reverting to the previous version and see if that does the trick.
Cheers!
GeoffJanuary 21, 2015 at 2:12 am #935557Carl
ParticipantThanks Geoff. I tried all these and in the end found adding the snippet to the bottom of the functions.php worked! 🙂
January 21, 2015 at 8:21 pm #936015Geoff
MemberNice! Yeah, sometimes it helps to move functions to either the very top of the bottom. I’m glad that did the trick. 🙂
I’ll go ahead and close this thread, but please let us know if anything else comes up–we’d be happy to help.
Cheers!
Geoff -
AuthorPosts
- The topic ‘Title "Events" randomly gone back to default’ is closed to new replies.
