Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * This emulates a private method from the WooTickets class, therefore should not be considered
- * future proof.
- *
- * @param $event_id
- * @return array
- */
- function get_wootickets_ids( $event_id ) {
- if ( is_object( $event_id ) )
- $event_id = $event_id->ID;
- $query = new WP_Query( array( 'post_type' => 'product',
- 'meta_key' => '_tribe_wooticket_for_event',
- 'meta_value' => $event_id,
- 'meta_compare' => '=',
- 'posts_per_page' => - 1,
- 'fields' => 'ids',
- 'post_status' => 'publish', ) );
- return $query->posts;
- }
- function add_to_cart_wooticket_btns() {
- $tickets = get_wootickets_ids(get_the_ID());
- foreach ($tickets as $ticket_id)
- echo '<a href="'.do_shortcode('[add_to_cart_url id="'.$ticket_id.'"]').'"> Add to Cart </a>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement