Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theeventscalendar/eedc81ba148e0346dfee to your computer and use it in GitHub Desktop.
Save theeventscalendar/eedc81ba148e0346dfee to your computer and use it in GitHub Desktop.
<?php
$count = 0;
echo '<ul>';
foreach ( $tickets as $ticket ) {
global $product;
$count++;
if ( class_exists( 'WC_Product_Simple' ) ) $product = new WC_Product_Simple( $ticket->ID );
else $product = new WC_Product( $ticket->ID );
$price = $product->get_price_html();
$link = '<a href="' . $product->get_permalink() . '">Buy!</a>';
echo "<li> $ticket->name $price $link </li>";
}
if ( 0 === $count )
echo '<li> There are no tickets available for this event </li>';
echo '</ul>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment