Skip to content

Instantly share code, notes, and snippets.

Created December 30, 2014 21:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/37b68732c7ffdb400f1b to your computer and use it in GitHub Desktop.
Save anonymous/37b68732c7ffdb400f1b to your computer and use it in GitHub Desktop.
Place the add to cart link right on the registration page. Works with Event Espresso 3 and Multi Event Registration.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action('action_hook_espresso_social_display_buttons', 'single_custom_cart_link');
function single_custom_cart_link($event_id) {
global $wpdb;
$event_name = $wpdb->get_var("SELECT event_name FROM " . EVENTS_DETAIL_TABLE . " WHERE id='" . $event_id . "'");
?><div class="custom-cart-link" style="display:block;">
<?php echo do_shortcode('[ESPRESSO_CART_LINK event_id="'.$event_id.'" event_name="'.$event_name.'" anchor="Add this session to your cart"]'); ?>
</div>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment