Skip to content

Instantly share code, notes, and snippets.

@lorenzocaum
Created October 2, 2015 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorenzocaum/a81b68810c46c137f349 to your computer and use it in GitHub Desktop.
Save lorenzocaum/a81b68810c46c137f349 to your computer and use it in GitHub Desktop.
How to change the add to event cart button label in Event Espresso 4

Add the sample code below to your child theme's functions.php file or in a site specific plugin. Then change REPLACE ME to the new messaging that you would like to display to your attendees/registrants.

<?php
//* Do NOT include the opening php tag

//* Adjust the add to event cart button text
function ee_custom_messaging_add_to_event_cart( $translated, $original, $domain ) {
    $strings = array(
        'Add to %s' => 'Register Now',
    );
    if ( isset( $strings[$original] ) ) {
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
    return $translated;
}
add_filter( 'gettext', 'ee_custom_messaging_add_to_event_cart', 10, 3 );
@lorenzocaum
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment