Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/1fd543d0494bde1629cf to your computer and use it in GitHub Desktop.
Save joshfeck/1fd543d0494bde1629cf to your computer and use it in GitHub Desktop.
Example event archive loop that displays events in an html table. You can adapt this into your WP theme by copying its archive.php file into your child theme, rename it to archive-espresso_events.php. Then replace the standard loop with the following code example. Requires Event Espresso 4.
<?php if ( have_posts() ) : ?>
<table class="events">
<thead>
<tr>
<th>Event</th>
<th>Tickets available</th>
<th>Starts</th>
<tr>
</thead>
<tbody>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<tr>
<td class="event_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td>
<td class="tickets"><?php espresso_event_tickets_available() ?></td>
<td class="start_date"><?php echo date(get_option('date_format'). ' '.get_option('time_format'), strtotime($post->DTT_EVT_start)) ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
<?php else : ?>
<?php echo 'No upcoming events'; ?>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment