Support

Home Forums Event Espresso Premium site specific plugin with functicode added not working to change text on buttons

site specific plugin with functicode added not working to change text on buttons

Posted: August 16, 2015 at 11:39 pm

Viewing 1 reply thread


aaron gay

August 16, 2015 at 11:39 pm

Hi
I followed your article on adding a site specific plugin to change text on the buttons – for e.g. Finalize Registration to Complete Registration but its not applying.
https://eventespresso.com/wiki/customize-checkout-registration-button-text/

Can you help please?

Thanks Jodi


Tony

  • Support Staff

August 17, 2015 at 9:03 am

Hi Jodi,

Is it only the above phrase you are looking to change or all of the buttons?

Simply because this function:

function jodi_custom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        'Finalize Registration' => 'Complete Registration',
        // 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', 'jodi_custom_filter_gettext', 10, 3 );

Is the easiest way to change that text, but if you want to change multiple buttons it may be better to do so with another function.

Add the above to a Site Specific Plugin (recommended) or within your themes functions.php file.

Viewing 1 reply thread

The support post ‘site specific plugin with functicode added not working to change text on buttons’ 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