Support

Home Forums Event Espresso Premium Change Text on Checkout Page

Change Text on Checkout Page

Posted: September 21, 2018 at 12:20 pm

Viewing 2 reply threads


baystate

September 21, 2018 at 12:20 pm

Hi,
I am trying to change the text on the checkout page for Attendee Information and Attendee 1 (or %d). I followed the custom function for that as posted in other threads and the Attendee information changed to participant information as I wanted. However Attendee 1 is still Attendee 1. I have that line as:
‘Attendee %d’ => ‘Student %d’,

Here is the function as a whole. Any reason why this isn’t changing? It can be seen at:
https://bsss.staging.wpengine.com/class/brookline-cleveland-circle-session-i/

Full function:
add_filter( ‘gettext’, ‘ee_venue_filter_gettext’, 10, 3 );
function ee_venue_filter_gettext( $translated, $original, $domain ) {

// This is an array of original strings
// and what they should be replaced with
$strings = array(
‘Venue’ => ‘Rink’,
‘Venue:’ => ‘Rink:’,
‘Venues’ => ‘Rinks’,
‘Venue Website:’ => ‘Rink Website:’,
‘Venue Phone:’ => ‘Rink Phone:’,
‘Attendee Information’ => ‘Participant Information’,
‘Attendee %d’ => ‘Student %d’,
// 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;
}

Thank you!


Josh

  • Support Staff

September 21, 2018 at 1:12 pm

Hi,

That particular string is wrapped in a different translation function, esc_html_x(). So in this case you’d use a different filter hook. Here’s a code example that you can follow:

https://gist.github.com/joshfeck/62183600028f7ff7bd135bfdc89c5684


baystate

September 21, 2018 at 3:26 pm

Thanks Josh, that worked!

Viewing 2 reply threads

The support post ‘Change Text on Checkout Page’ 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