Skip to content

Instantly share code, notes, and snippets.

@theresavs
Last active May 8, 2017 10:00
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 theresavs/614829a9c2d80bd95e6688f6eb675d51 to your computer and use it in GitHub Desktop.
Save theresavs/614829a9c2d80bd95e6688f6eb675d51 to your computer and use it in GitHub Desktop.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_custom_sold_out_messaging( $translated, $original, $domain ) {
// This is an array of original strings
// and what they should be replaced with
$strings = array(
'Sold&nbsp;Out' => 'Class full',
'Confirm and go to payment page' => 'Complete registration',
'No events available...' => 'No upcoming classes at this time...',
'Event Date Ticket Uses' => 'Class Admission',
'Sale Dates' => 'Registration Dates',
'The dates when this option is available for purchase.' => 'Dates when registration is available.',
'Goes On Sale:' => 'Start',
'Sales End:' => 'Ends',
'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to' => 'Date and time this class is scheduled for',
// 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', 'ee_custom_sold_out_messaging', 10, 3 );
?>
@Pebblo
Copy link

Pebblo commented May 8, 2017

'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to' => 'Date and time this class is scheduled for',

Should be:

'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s' => 'Date and time this class is scheduled for %1$s%2$sAdmission is always one person per ticket.%3$s'

See: https://eventespresso.com/topic/show-number-of-attendees-for-an-event/#post-240746

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