Show x form y tickets available on booking form

[ad_1]

Well actually it is the file ticket-single.php and tickets-list.php, but still hard to do.

You can do it without modifying the templates. Instead you can use the following code snippet to add another column to show the remaining spaces for each ticket type:

add_action('em_booking_form_tickets_col_remaining', 'my_tickets_remaining', 10, 2);
function my_tickets_remaining($EM_Ticket, $M_Event) {
echo '<td class="em-bookings-ticket-table-remaining">' . $EM_Ticket->get_booked_spaces() . '/' . $EM_Ticket->get_spaces() . '</td>';
}
add_filter('em_booking_form_tickets_cols', 'my_em_booking_form_tickets_cols', 10, 2);
function my_em_booking_form_tickets_cols($collumns, $EM_Event) {
return [ 'type' => __('Ticket Type','events-manager'), 'price' => __('Price','events-manager'), 'remaining' => __('Remaining','events-manager'), 'spaces' => __('Spaces','events-manager') ];
}

You can use the Code Snippets plugin to add this code snippet.

  • This reply was modified 23 hours, 48 minutes ago by joneiseman.

Cool it works 🙂
And just a few lines of code, well done. Again you learned me something new: How is hooking in in EM working. Not that I can write the code you did, that is still beyond my PHP skills, but I am learning.

Thank you once again. You are a great help here and I am grateful. It helps me to get our site working as we want.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer