Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="qdWidget tickets">
- <?php
- $saleStart = null;
- $saleEnd = null;
- $ticketArray = woot_get_tickets( false ); //grab ticket information using Woot Libraries Plugin
- if($ticketArray){
- foreach($ticketArray as $ticket){
- $productMeta = get_post_meta($ticket->id);
- if(!isset($saleStart)){
- $saleStart = new DateTime($productMeta["_ticket_start_date"][0]);
- }else{
- $tempStart = new DateTime($productMeta["_ticket_start_date"][0]);
- if($tempStart < $saleStart){
- $saleStart = $tempStart;
- }
- }
- if(!isset($saleEnd)){
- $saleEnd = new DateTime($productMeta["_ticket_end_date"][0]);
- }else{
- $tempEnd = new DateTime($productMeta["_ticket_end_date"][0]);
- if($tempEnd > $saleEnd){
- $saleEnd = $tempEnd;
- }
- }
- }
- $rightNow = new DateTime('NOW');
- if($rightNow < $saleStart){
- //Right now is before tickets go on sale.
- echo "<h2>Tickets</h2>";
- echo "<p><strong>TICKETS NOT ON SALE YET</strong></p>";
- }else if($rightNow > $saleEnd){
- //Right now is after tickets have gone off sale.
- echo "<h2>Tickets</h2>";
- echo "<p><strong>TICKETS ARE NO LONGER ON SALE</strong></p>";
- }else{
- //Right now tickets are on sale.
- do_action( 'tribe_events_single_event_after_the_meta' );
- echo get_post_meta( get_the_ID(), ‘start_date’, true);
- }
- }
- ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment