Moving 'Tickets' from bottom of sidebar to the top

Home Forums Ticket Products Event Tickets Plus Moving 'Tickets' from bottom of sidebar to the top

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1081352
    Paul
    Participant

    Hi,

    I have tried adding the code at https://theeventscalendar.com/knowledgebase/moving-the-ticket-form/ to my theme’s functions.php file but I get the following error:

    Fatal error: Call to undefined function tribe_etp_move_tickets_purchase_form() in functions.php on line 605

    Can anyone help? I just want to move the ‘Tickets’ section at the bottom of the right sidebar to the top of the sidebar (http://catthorpemanor.co.uk/event/game-of-groans-murder-mystery-saturday-16th-april/).

    N.B. I have added the following code to my theme’s functions.php file – the error code has gone but it hasn’t moved the Tickets section:

    ————

    /*
    * 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 ) {
    $etp_classes = array(
    ‘Tribe__Tickets_Plus__Commerce__EDD__Main’,
    // ‘Tribe__Tickets_Plus__Commerce__Shopp__Main’, // As of ETP v4.0 Shopp will generate errors when referenced, if not active. Uncomment this line if you have Shopp Active
    ‘Tribe__Tickets_Plus__Commerce__WPEC__Main’,
    ‘Tribe__Tickets_Plus__Commerce__WooCommerce__Main’
    );
    foreach ( $etp_classes as $ticket_class ) {
    if ( ! class_exists( $ticket_class ) ) break;
    $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 );
    }
    }
    }

    ————

    Thanks.

    Paul

    #1081365
    Brian
    Keymaster

    Hi Again,

    Thanks for creating your own ticket.

    Since we do not have a side bar in our standard template it is hard to say the exact hook needed for this to work. So it will take some trial and error.

    You should only use one of the following at time to test where it move the tickets field:

    tribe_etp_move_tickets_purchase_form( 'tribe_events_single_event_before_the_meta' );

    tribe_etp_move_tickets_purchase_form( 'tribe_events_single_event_after_the_content', 5 );

    tribe_etp_move_tickets_purchase_form( 'tribe_events_single_event_before_the_content' );

    Let me know if any of those work.

    Thanks

    #1081372
    Paul
    Participant

    Hi,

    Would each of these lines be added to the above code? For example, for number 1:

    /*
    * 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 = 100 ) {
    $etp_classes = array(
    ‘Tribe__Tickets_Plus__Commerce__EDD__Main’,
    // ‘Tribe__Tickets_Plus__Commerce__Shopp__Main’, // As of ETP v4.0 Shopp will generate errors when referenced, if not active. Uncomment this line if you have Shopp Active
    ‘Tribe__Tickets_Plus__Commerce__WPEC__Main’,
    ‘Tribe__Tickets_Plus__Commerce__WooCommerce__Main’
    );
    foreach ( $etp_classes as $ticket_class ) {
    if ( ! class_exists( $ticket_class ) ) break;
    $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 );
    tribe_etp_move_tickets_purchase_form( ‘tribe_events_single_event_before_the_content’ );
    }
    }
    }

    Thanks,

    Paul

    • This reply was modified 8 years, 2 months ago by Paul.
    #1081378
    Paul
    Participant

    Brian, disregard my last message, adding:

    tribe_etp_move_tickets_purchase_form( ‘tribe_events_single_event_before_the_meta’ );

    After the above code block has worked fine.

    Many thanks for your help,

    Paul

    #1081412
    Brian
    Keymaster

    Great, glad it helps, I am going to go ahead and close this ticket, but if you need help on this or something else please post a new ticket.

    Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Moving 'Tickets' from bottom of sidebar to the top’ is closed to new replies.