Advertisement
eventsmanager

Add event categories to you recent bookings

Mar 10th, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2. /*
  3. * paste in your theme functions.php or wp-content/mu-plugins/function.php
  4. * After adding in your functions.php, go to Events > Bookings > Recent Bookings or by clicking on the Event
  5. * click on the Gear icon and drag&drop field "Event Categories"
  6. */
  7.  
  8. function my_em_bookings_table_cols_template_event_categories($template, $EM_Bookings_Table){
  9. $template['event_categories'] = 'Event Categories';
  10. return $template;
  11. }
  12. add_action('em_bookings_table_cols_template', 'my_em_bookings_table_cols_template_event_categories',10,2);
  13.  
  14. function my_em_custom_booking_form_cols_event_categories($val, $col, $EM_Booking, $EM_Bookings_Table, $csv){
  15. if( $col == 'event_categories' ){
  16. echo '<ul class="event-categories">';
  17. foreach($EM_Booking->get_event()->get_categories() as $EM_Category){
  18. echo '<li>'.$EM_Category->output("#_CATEGORYNAME").'</li>';
  19. }
  20. echo '</ul>';
  21. }
  22. return $val;
  23. }
  24. add_filter('em_bookings_table_rows_col','my_em_custom_booking_form_cols_event_categories', 10, 5);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement