Guest User

Untitled

a guest
May 15th, 2013
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2. /**
  3. * Returns an array of all WooTicket products associated with the event.
  4. *
  5. * @param null $post_id
  6. * @return array
  7. */
  8. function get_wooticket_products($post_id = null) {
  9. global $wpdb;
  10. $id = TribeEvents::postIdHelper($post_id);
  11. $products = array();
  12.  
  13. $product_ids = $wpdb->get_col($wpdb->prepare(
  14. "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %d",
  15. '_tribe_wooticket_for_event', $id
  16. ));
  17.  
  18. if ($product_ids) foreach ($product_ids as $id)
  19. $products[] = new WC_Product_Simple($id);
  20.  
  21. return $products;
  22. } ?>
Advertisement
Add Comment
Please, Sign In to add comment