Skip to content

Instantly share code, notes, and snippets.

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 jesseeproductions/edcec228a2cccb107d878e474faae21a to your computer and use it in GitHub Desktop.
Save jesseeproductions/edcec228a2cccb107d878e474faae21a to your computer and use it in GitHub Desktop.
Change the Get Tickets and RSVP Now on List View and Single Events by Context
/**
* Change the Get Tickets and RSVP Now on List View and Single Events by Context
*
* @param string $translation The translated text.
* @param string $text The text to translate.
* @param string $context The option context string.
* @param string $domain The domain slug of the translated text.
*
* @return string The translated text or the custom text.
*/
add_filter( 'gettext_with_context', 'tribe_change_get_tickets_and_rsvp_now_by_context', 20, 4 );
function tribe_change_get_tickets_and_rsvp_now_by_context( $translation, $text, $context, $domain ) {
if (
$domain != "default" &&
(
strpos( $domain, 'event-' ) !== 0
)
) {
return $translation;
}
$ticket_rsvp_text = array(
// RSVP Now List View
'list view rsvp now ticket button' => 'Register Now!',
// Confirm RSVP Form - Single Views
'tickets process button text' => 'Register Now!',
// Get Tickets on List View
'list view buy now ticket button' => 'Register Now!',
// Get Tickets Form - Single View
'Get selected tickets.' => 'Register Now!',
);
// If we don't have replacement text, bail.
if ( empty( $ticket_rsvp_text[ $context ] ) ) {
return $translation;
}
return $ticket_rsvp_text[ $context ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment