Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active April 4, 2016 18:04
Show Gist options
  • Save Pebblo/a7cd1516d6b478b8d443 to your computer and use it in GitHub Desktop.
Save Pebblo/a7cd1516d6b478b8d443 to your computer and use it in GitHub Desktop.
Adds a 'Go back to {event}' button to the registration-checkout page, change the styling to suit - http://take.ms/VXbHG
<?php
/*
Plugin Name: EE Site Specific Plugin
Description: Add custom functions for Event Espresso 4 here.
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
//Add a 'Go back to the {event}' button below the registration form and payment selection.
function ee_display_return_to_event_on_spco(){
//Pull in the current EE object.
$checkout = EE_Registry::instance()->SSN->checkout();
//Check we have an instance of the EE_Checkout object
if ( $checkout instanceof EE_Checkout ) {
//Pull the transaction object from checkout
$transaction = $checkout->transaction;
if ( $transaction instanceof EE_Transaction ) {
//Pull the primary_registrant from the transaction.
$primary_registrant = $transaction->primary_registration();
echo '<div class="jst-rght">
<a class="ee-button ee-roundish indented-text" href="' .get_post_permalink($primary_registrant->event()->ID()). '">Go back to the "' . get_the_title($primary_registrant->event()->ID()) . '"</a>
</div>';
}
}
}
add_action( 'AHEE__SPCO__after_registration_steps', 'ee_display_return_to_event_on_spco' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment