Support

Home Forums Event Espresso Premium Changing the word ticket to something else

Changing the word ticket to something else

Posted: May 25, 2015 at 3:45 pm

Viewing 9 reply threads


Chris Stambaugh

May 25, 2015 at 3:45 pm

Hi,

We use EventEspresso for registering students in our classes.

Therefore, the term “ticket” is confusing to some of them. They don’t understand why they’d purchase a ticket for a class, rather than a spot or some other word.

How can I change the word “ticket” through EE4 so that it is clearer for my clients?

Thanks,

Paul


Dean

May 26, 2015 at 1:52 am

Hi,

The best way to do that would be via the language files, we have a guide to a few options on how to go about his here: https://eventespresso.com/wiki/how-to-change-wording-with-poedit/


Chris Stambaugh

May 26, 2015 at 5:56 pm

Hi,

Tried all three methods. None seem to work.

I’m trying to change “AVAILABLE TICKETS” header for instance on the registration page and nothing seems to make a difference.

Any other suggestions?

Paul


Dean

May 27, 2015 at 1:59 am

Hi,

I tested with the gettext function in a site specific plugin and it worked fine: http://take.ms/s2au0

I didn’t retest the language files but those are usually tried and tested methods already.

More info on site specific plugins: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


Chris Stambaugh

May 28, 2015 at 2:12 pm

That seems to work for some things, but not others.

For instance, I can change the AVAILABLE TICKETS to SPACES AVAILABLE, but underneath the description where it says the maxinum tickets available for purchase, I cannot change that ticket text to something else.

Similarly, I cannot change the headings for the event details where it lists:

EVENT DATE THIS TICKET THIS TICKET TOTAL TICKETS
SOLD LEFT SOLD

Not sure what the difference is.

Paul


Josh

  • Support Staff

May 28, 2015 at 3:20 pm

Hi Paul,

You’ll see the difference if you open up Event Espresso in your IDE. Here are a few examples:

This Ticket%sSold, This Ticket%sLeft, Total Tickets%sSold, Total Spaces%sLeft.

The above %s are there to allow for dynamically adding html, without directly adding the html to the translated string.


Chris Stambaugh

May 30, 2015 at 1:50 pm

Josh,

But, I’m just trying to change the word ticket to space and tickets to spaces.

And that doesn’t seem to work and I’m at a loss as to why.

Even if I have the code search for Ticket%sSold and replace it with Spots%sSold, it doesn’t work.

Paul


Dean

June 1, 2015 at 3:53 am

Hi,

The thing with string translation in WordPress, is that you can’t change individual words in a string, you have to change the full string (even if you are keeping most of it the same).

This will change the tickets sold area wording.

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        'This Ticket%sSold' => 'Spot%sSold',
        'This Ticket%sLeft' => 'Spot%sLeft',
        'Total Tickets%sSold' => 'Total Spots%sSold',
        'Total Spaces%sLeft' => 'Total Spots%sLeft',
        // Add some more strings here
    );

    // See if the current string is in the $strings array
    // If so, replace its translation
    if ( isset( $strings[$original] ) ) {
        // This accomplishes the same thing as __()
        // but without running it through the filter again
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
 
    return $translated;
}
 
add_filter( 'gettext', 'mycustom_filter_gettext', 10, 3 );


Chris Stambaugh

June 11, 2015 at 1:37 pm

Okay,

So the one string left giving me difficulty is:

* Please note that a maximum number of 4 tickets can be purchased for this event per order.

Where I want to change “tickets” to “spots”

Thanks,

Paul


Josh

  • Support Staff

June 11, 2015 at 2:49 pm

This is the string in full with a suggested replacement:

'Please note that a maximum number of %d tickets can be purchased for this event per order.' => 'Please note that a maximum number of %d spots can be purchased for this event per order.',

Viewing 9 reply threads

The support post ‘Changing the word ticket to something else’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso