Moving Ticket Purchase Form in Genesis, How to Properly apply remove_action

Home Forums Ticket Products Event Tickets Plus Moving Ticket Purchase Form in Genesis, How to Properly apply remove_action

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1145894
    Yulia
    Participant

    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 );
    
    #1146273
    Cliff
    Member

    Hi 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.

    #1146438
    Yulia
    Participant

    Hi 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.

    #1147056
    Cliff
    Member

    Yulia, 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

    ?

    #1147463
    Yulia
    Participant

    The 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.

    #1147706
    Cliff
    Member

    I 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?

    #1148007
    Yulia
    Participant

    No, unfortunately not, it was a wild stab trying to work through the original function to see if i could make it work.

    #1148085
    Cliff
    Member

    Could you share a link (Private Reply is fine) so I can see a page it’s happening on?

    #1156680
    Support Droid
    Keymaster

    Hey 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

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Moving Ticket Purchase Form in Genesis, How to Properly apply remove_action’ is closed to new replies.