Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * This solution adds a piece of text reading "Sold out!" just after the event title
- * in list view.
- *
- * @uses tribe_has_wootickets()
- * @see http://pastebin.com/hPS9nwft
- *
- * @uses get_wooticket_products()
- * @see http://pastebin.com/csuqeikG
- */
- function wootickets_list_view_sold_out() {
- global $post;
- if (TribeEvents::POSTTYPE !== $post->post_type) return;
- if (!tribe_has_wootickets($post->ID)) return;
- $tickets = get_wooticket_products($post->ID);
- $stock = 0;
- foreach ($tickets as $ticket)
- $stock += $ticket->get_stock_quantity();
- if (0 === $stock) echo '<span class="wootickets-sold-out"> Sold out! </span>';
- }
- // Hook up so it fires during the event list loop
- add_action('tribe_events_after_the_event_title', 'wootickets_list_view_sold_out');
Advertisement
Add Comment
Please, Sign In to add comment