Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created June 8, 2016 22:18
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 joshfeck/f20b174e545e9ea983c6e955c18d6f2e to your computer and use it in GitHub Desktop.
Save joshfeck/f20b174e545e9ea983c6e955c18d6f2e to your computer and use it in GitHub Desktop.
Some examples of how to change the text in the "Next Step" buttons of Event Espresso 4.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function espresso_filter_spco_submit_button_text( $submit_button_text, EE_Checkout $checkout ) {
if ( ! $checkout instanceof EE_Checkout || ! $checkout->current_step instanceof EE_SPCO_Reg_Step || ! $checkout->next_step instanceof EE_SPCO_Reg_Step ) {
return $submit_button_text;
}
// $checkout->revisit - whether this is the first time thru SPCO or not : false = first visit, true = return visit (ie repay or edit)
// details for the *current* reg step
// $checkout->current_step->slug(); ex: 'attendee_information', 'payment_options', 'finalize_registration'
// $checkout->current_step->name();
// details for the NEXT SPCO Reg Step that follows the CURRENT SPCO Reg Step
// $checkout->next_step->slug();
// $checkout->next_step->name();
if ( $checkout->next_step->slug() == 'finalize_registration' ) {
$submit_button_text = __( 'Go to Finalize Registration step', 'event_espresso' );
} else if ( $checkout->current_step->slug() == 'attendee_information' && $checkout->revisit ) {
$submit_button_text = sprintf( __( 'Welcome back, you can go to %1$s', 'event_espresso' ), $checkout->next_step->name() );
} else if ( $checkout->current_step->slug() == 'attendee_information' ) {
$submit_button_text = sprintf( __( 'Go to %1$s step', 'event_espresso' ), $checkout->next_step->name() );
} else {
$submit_button_text = sprintf( __( 'Finish %1$s and go to %2$s', 'event_espresso' ), $checkout->current_step->name(), $checkout->next_step->name() );
}
return $submit_button_text;
}
add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'espresso_filter_spco_submit_button_text', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment