Advertisement
eventsmanager

Display #_BOOKINGATTENDEES on the frontend

Feb 28th, 2016
1,675
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. /*
  2. This snippet will add custom placeholder to display the contents of #_BOOKINGATTENDEES
  3.  
  4. - create php file and folders under wp-contents/mu-plugins/functions.php
  5. - edit functions.php and paste the snippet below then save
  6. - you can now use #_MYBOOKINGATTENDEES under Events > Settings > Formatting > Events eg. default single events page format
  7.  
  8. =========
  9. NOTE:
  10. =========
  11. by default you need to change the formats of #_BOOKINGATTENDEES under events-manager-pro/templates/placeholders/bookingattendees-ticket.php
  12.  
  13. to use templates: http://wp-events-plugin.com/documentation/using-template-files/
  14. eg. wp-content/themes/Your Theme/plugins/events-manager-pro/placeholders/bookingattendees-ticket.php
  15.  
  16. */
  17.  
  18. add_filter('em_event_output_placeholder','my_em_booking_attendees',1,3);
  19. function my_em_booking_attendees($replace, $EM_Event, $result){
  20. global $wp_query, $wp_rewrite;
  21. switch( $result ){
  22. case '#_MYBOOKINGATTENDEES':
  23. $EM_Bookings = $EM_Event->get_bookings();
  24. $replace = '';
  25. foreach( $EM_Bookings as $EM_Booking ){
  26. $replace .= str_replace("\r\n","<br>",$EM_Booking->output('#_BOOKINGATTENDEES'));
  27. }
  28. break;
  29. }
  30. return $replace;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement