Advertisement
eventsmanager

Custom booking date placeholder for my-bookings.php template

Apr 14th, 2015
759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. /*
  2. * This custom booking date placeholder can be use in /templates/my-bookings.php template
  3. *
  4. */
  5. add_filter('em_booking_output_placeholder','my_em_booking_date',1,3);
  6. function my_em_booking_date($replacement, $EM_Booking, $result){
  7. global $wpdb;
  8.  
  9. if ($result == '#_CUSTOMBOOKINGDATE') {
  10. $tablename = $wpdb->prefix.'em_bookings';
  11. $sql = $wpdb->prepare( "SELECT date_format(booking_date,'%%Y-%%m-%%d') as booking_date FROM $tablename WHERE booking_id = %d ", $EM_Booking->booking_id);
  12. $replacement = $wpdb->get_var($sql);
  13. }
  14.  
  15. return $replacement;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement