Home › Forums › Ticket Products › Event Tickets Plus › Moving 'Tickets' from bottom of sidebar to the top
- This topic has 4 replies, 2 voices, and was last updated 8 years, 2 months ago by Brian.
-
AuthorPosts
-
February 24, 2016 at 4:44 am #1081352PaulParticipant
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
February 24, 2016 at 5:22 am #1081365BrianKeymasterHi 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
February 24, 2016 at 5:45 am #1081372PaulParticipantHi,
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.
February 24, 2016 at 5:53 am #1081378PaulParticipantBrian, 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
February 24, 2016 at 7:12 am #1081412BrianKeymasterGreat, 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!
-
AuthorPosts
- The topic ‘Moving 'Tickets' from bottom of sidebar to the top’ is closed to new replies.