Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active August 11, 2021 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Pebblo/6ca533539b2ed37ed88801825fdd2f2f to your computer and use it in GitHub Desktop.
Save Pebblo/6ca533539b2ed37ed88801825fdd2f2f to your computer and use it in GitHub Desktop.
Examples of how to change the ticket selector submit button text from 'Register Now' to 'Purchase Tickets' and also how to change the 'View Details' button to
<?php //Please do not include the opening PHP tag if you already have one.
function tw_ee_custom_filter_ticket_selector_submit_button_text( $btn_text, $event ) {
return __( 'Purchase Tickets', 'event_espresso' );
}
add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', 'tw_ee_custom_filter_ticket_selector_submit_button_text', 10, 2 );
<?php //Please do not include the opening PHP tag if you already have one.
//Another example that uses a custom field within the event.
//Set a ee_custom_register_text custom field with the string you want to replace the default text with on that event as the value.
//If no value has been set default to the standard button text (Register Now).
function tw_ee_custom_filter_ticket_selector_submit_button_text( $btn_text, $event ) {
$ee_custom_register_text = $event->get_post_meta( 'ee_custom_register_text', true );
if ( $ee_custom_register_text ) {
$btn_text = __( 'Custom Register Text Here', 'event_espresso' );
}
return $btn_text;
}
add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', 'tw_ee_custom_filter_ticket_selector_submit_button_text', 10, 2 );
<?php //Please do not include the opening PHP tag if you already have one.
//Another example that uses a custom field within the event for the 'View Details' text.
//Set a ee_custom_view_details_text custom field with the string you want to replace the default text with on that event as the value.
//If no value has been set default to the standard button text (Register Now).
function tw_ee_custom_filter_ticket_selector_view_details_button_text( $btn_text, $event ) {
$ee_custom_register_text = $event->get_post_meta( 'ee_custom_view_details_text', true );
if ( $ee_custom_register_text ) {
return $ee_custom_register_text;
}
return $btn_text;
}
add_filter( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', 'tw_ee_custom_filter_ticket_selector_view_details_button_text', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment