Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active December 16, 2015 10:29
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/5420669 to your computer and use it in GitHub Desktop.
Save joshfeck/5420669 to your computer and use it in GitHub Desktop.
Displays a list of events that started before today's date. Can be placed into a page template or within a widget template. Requires WP + Event Espresso.
<ul>
<?php
global $wpdb;
$tablename = $wpdb->prefix . events_detail;
$pastevents = $wpdb->get_results("SELECT * FROM $tablename WHERE start_date < curdate() AND event_status <> 'D' ");
foreach ( $pastevents as $pastevent ){
echo '<li><a href="' . espresso_reg_url($pastevent->id) . '">' . stripslashes($pastevent->event_name) . '</a></li>';
}
?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment