Support

Home Forums Event Espresso Premium Does the 'custom function' on this page, work for EE4, or just EE3?

Does the 'custom function' on this page, work for EE4, or just EE3?

Posted: January 28, 2018 at 1:42 pm

Viewing 1 reply thread


pickwicksplum

January 28, 2018 at 1:42 pm

https://eventespresso.com/wiki/how-to-change-wording-with-poedit/

I’m trying to get my “Register Now” buttons to read “Learn More” and I’ve tried using (and it doesn’t work):

function mycustom_filter_gettext( $translated, $original, $domain ) {

// This is an array of original strings
// and what they should be replaced with
$strings = array(
‘Register’ => ‘Sign up’,
‘Register Now’ => ‘Learn More’,
‘Confirm and go to payment page’ => ‘Complete registration’,
‘No events available…’ => ‘No upcoming classes at this time…’,
‘click here to add a new state/province’ => ‘click here to enter address outside US/Canada’,
// 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 );


Tony

  • Support Staff

January 29, 2018 at 4:24 am

Hi there,

Can you post a link to the page you are trying to change the text on, please?

The above function should work fine for EE4 (it’s using a WordPress hook so doesn’t change across EE versions), I added the above snippet to one of my test sites and its changing the ‘Register Now’ text on the ticket selector to ‘Learn More’ – http://take.ms/28s34

Are you adding the above to a custom functions plugin?/ If so have you confirmed the plugin you are adding it to is active?

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

Viewing 1 reply thread

The support post ‘Does the 'custom function' on this page, work for EE4, or just EE3?’ 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