-
-
Save joshfeck/bb977b3cc27a5ffa619761430a65ff14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
function tw_custom_filter_gettext( $translated, $original, $domain ) { | |
// This is an array of original strings | |
// and what they should be replaced with | |
$strings = array( | |
'Sold Out' => 'Class Full', | |
// 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', 'tw_custom_filter_gettext', 10, 3 ); | |
function add_cap_to_access_message( | |
$text, | |
$ticket, | |
$ticket_price, | |
$ticket_status | |
) { | |
$cap_required = ''; | |
$cap_required = $ticket->get_extra_meta('ee_ticket_cap_required', true); | |
$search = '_'; | |
$replace = ' '; | |
$cap_required_display_name = str_replace( $search, $replace, $cap_required); | |
$text = 'This course is restricted to ' . $cap_required_display_name . ' employees.'; | |
return $text; | |
} | |
add_filter( | |
'FHEE__EED_WP_Users_Ticket_Selector__maybe_restrict_ticket_option_by_cap__no_access_msg', | |
'add_cap_to_access_message', | |
10, | |
4 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment