Guest User

Untitled

a guest
Jul 5th, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. /*
  2. * Moves the front-end ticket purchase form, accepts WP action/hook and optional hook priority
  3. *
  4. * @param $ticket_location_action WP Action/hook to display the ticket form at
  5. * @param $ticket_location_priority Priority for the WP Action
  6. */
  7. function tribe_etp_move_tickets_purchase_form ( $ticket_location_action, $ticket_location_priority = 10 ) {
  8. if ( ! class_exists( 'Tribe__Tickets__Tickets') ) return;
  9. $etp_classes = array(
  10. 'Easy_Digital_Downloads' => 'Tribe__Tickets_Plus__Commerce__EDD__Main',
  11. 'ShoppVersion' => 'Tribe__Tickets_Plus__Commerce__Shopp__Main',
  12. 'WP_eCommerce' => 'Tribe__Tickets_Plus__Commerce__WPEC__Main',
  13. 'Woocommerce' => 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main',
  14. 'Tribe__Tickets__Tickets' => 'Tribe__Tickets__RSVP',
  15. );
  16. foreach ( $etp_classes as $ecommerce_class => $ticket_class) {
  17. if ( ! class_exists( $ecommerce_class ) || ! class_exists( $ticket_class ) ) continue;
  18. $form_display_function = array( $ticket_class::get_instance(), 'front_end_tickets_form' );
  19. if ( has_action ( 'tribe_events_single_event_after_the_meta', $form_display_function ) ) {
  20. remove_action( 'tribe_events_single_event_after_the_meta', $form_display_function, 5 );
  21. add_action( $ticket_location_action, $form_display_function, $ticket_location_priority );
  22. }
  23. }
  24. }
  25. /*
  26. * Uncomment to Move Ticket Form Below the Event Description
  27. */
  28. tribe_etp_move_tickets_purchase_form( 'tribe_events_single_event_after_the_content', 5 );
Advertisement
Add Comment
Please, Sign In to add comment