Title "Events" randomly gone back to default

Home Forums Calendar Products Events Calendar PRO Title "Events" randomly gone back to default

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #935117
    Carl
    Participant

    Hello,

    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

    #935226
    Geoff
    Member

    Hi 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!
    Geoff

    #935231
    Carl
    Participant

    Hi 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.

    #935243
    Geoff
    Member

    It’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!
    Geoff

     

    #935557
    Carl
    Participant

    Thanks Geoff. I tried all these and in the end found adding the snippet to the bottom of the functions.php worked! 🙂

    #936015
    Geoff
    Member

    Nice! 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

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Title "Events" randomly gone back to default’ is closed to new replies.