Skip to content

Instantly share code, notes, and snippets.

@lorenzocaum
Last active September 19, 2015 19:33
Show Gist options
  • Save lorenzocaum/efab9a75b9f4a08e075b to your computer and use it in GitHub Desktop.
Save lorenzocaum/efab9a75b9f4a08e075b to your computer and use it in GitHub Desktop.
Change the messaging for expired events in Event Espresso 4.

Add the sample code below to your child theme's functions.php file or in a site specific plugin.

<?php
//* Do NOT include the opening php tag
 
//* Replace the existing messaging text with something else
function ee_change_expired_tickets_messaging( $translated, $original, $domain ) {
 
    $strings = array(
        'We\'re sorry, but all tickets sales have ended because the event is expired.' => 'Unfortunately, all tickets have been sold!',
    );

    if ( isset( $strings[$original] ) ) {
        $translations = &get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
 
    return $translated;
}
 
add_filter( 'gettext', 'ee_change_expired_tickets_messaging', 10, 3 );
@lorenzocaum
Copy link
Author

References:

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