Support

Home Forums Event Espresso Premium Problems changing text

Problems changing text

Posted: February 3, 2017 at 5:30 am

Viewing 1 reply thread


Nat J

February 3, 2017 at 5:30 am

Hi, I have tried the documentation for changing text and had only 80% success. Firstly I’m not sure the edit via Poedit is up to date as the WPLANG option is no longer in the config file. BUT my problem is on this page http://build.testmyheart.org.uk/events/screening-event-6/

I would like to change the “Goes On Sale” text
I have this function coded

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        'Sold Out' => 'Fully Booked',
        'No events available...' => 'No upcoming screenings at this time...',
		'Goes On Sale' => 'Registration Opens',
		'Event Location' => 'Screening Location',
        // 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 );

But still no change. I have also tried the Quick Localisation but it doesn’t seem to change anything.


Josh

  • Support Staff

February 3, 2017 at 9:04 am

What you have now will change the “Goes On Sale” text in some places, but not in all places. You can add this to the array to target the other places:

'Goes On Sale' => 'Registration Opens'

Viewing 1 reply thread

The support post ‘Problems changing text’ 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