Home › Forums › Ticket Products › Event Tickets Plus › Moving Ticket Purchase Form in Genesis, How to Properly apply remove_action
- This topic has 9 replies, 4 voices, and was last updated 7 years, 7 months ago by Yulia.
-
AuthorPosts
-
July 30, 2016 at 11:37 pm #1145894YuliaParticipant
Hi,
We are using the event tickets plus in a custom post type wince we don’t need much in the way of calendar functionality. Our post type has a custom layout with our custom meta, some of which exists outside the main content area. So we are looking to move the tickets purchase form outside the main content area.
We used the function provided in your themer’s guide to move the ticket form and were able to modify it to use one of genesis hooks to add the form after the entry content with the proper priority ( I assume I have done this correctly but I will provide my sample ). Thats working great, but this still leaves the original purchase form at the bottom of the post content. I am wondering how to properly remove the tribe_etp_move_tickets_purchase_form function so that it shows up only in the new location.
/* * Moves the front-end ticket purchase form, accepts WP action/hook and optional hook priority * * @param $ticket_location_action WP Action/hook to display the ticket form at * @param $ticket_location_priority Priority for the WP Action */ function tribe_etp_move_tickets_purchase_form ( $ticket_location_action, $ticket_location_priority = 10 ) { if ( ! class_exists( 'Tribe__Tickets__Tickets') ) return; $etp_classes = array( 'Easy_Digital_Downloads' => 'Tribe__Tickets_Plus__Commerce__EDD__Main', 'ShoppVersion' => 'Tribe__Tickets_Plus__Commerce__Shopp__Main', 'WP_eCommerce' => 'Tribe__Tickets_Plus__Commerce__WPEC__Main', 'Woocommerce' => 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main', 'Tribe__Tickets__Tickets' => 'Tribe__Tickets__RSVP', ); foreach ( $etp_classes as $ecommerce_class => $ticket_class) { if ( ! class_exists( $ecommerce_class ) || ! class_exists( $ticket_class ) ) continue; $form_display_function = array( $ticket_class::get_instance(), 'front_end_tickets_form' ); if ( has_action ( 'tribe_events_single_event_after_the_meta', $form_display_function ) ) { remove_action( 'tribe_events_single_event_after_the_meta', $form_display_function, 5 ); add_action( $ticket_location_action, $form_display_function, $ticket_location_priority ); } } } // Customize Ticket Form Output for Genesis After Content tribe_etp_move_tickets_purchase_form( 'genesis_after_content', 15); // Remve The Original Tickets Form // remove_action( 'tribe_events_single_event_after_the_meta', $form_display_function, 5 );
August 1, 2016 at 2:23 pm #1146273CliffMemberHi Yulia.
Please reference our Genesis theme framework integration and Moving the Tickets Plus form KB articles and let me know if you have any follow-up questions.
August 2, 2016 at 2:16 am #1146438YuliaParticipantHi Clif,
The example I provided in my original post is from that support article. We were successfully able to move the ticket form, but since we are using a hook from our theme framework to move the form (see line 27) the original form remains and we end up with two copies of the ticket form. I need to know how to remove the original instance of the form.
August 3, 2016 at 8:05 am #1147056CliffMemberYulia, just using the code as-is from the help article should work for you in your Genesis theme’s functions.php
Why are you trying to use genesis_after_content instead of one of these:
- tribe_events_single_event_after_the_meta
- tribe_events_single_event_after_the_content
- tribe_events_single_event_before_the_content
?
August 4, 2016 at 12:03 am #1147463YuliaParticipantThe code does work but the layout of the custom post type has content related to our service that appears outside of the_content() function and we are looking at having the ticket sales form underneath that information. Using the genesis hook lets us move the ticket form but we are left with the original form still in place. So we are looking to see if we can remove the original instance of the form.
August 4, 2016 at 10:20 am #1147706CliffMemberI see in the code you initially posted that you commented out the last line. Does your code work as desired if you un-comment it?
August 4, 2016 at 11:45 pm #1148007YuliaParticipantNo, unfortunately not, it was a wild stab trying to work through the original function to see if i could make it work.
August 5, 2016 at 5:36 am #1148085CliffMemberCould you share a link (Private Reply is fine) so I can see a page it’s happening on?
August 27, 2016 at 9:35 am #1156680Support DroidKeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Moving Ticket Purchase Form in Genesis, How to Properly apply remove_action’ is closed to new replies.