Skip to content

Instantly share code, notes, and snippets.

@stephenharris
Forked from stephenh1988/upcoming-events.php
Created February 19, 2013 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stephenharris/4988311 to your computer and use it in GitHub Desktop.
Save stephenharris/4988311 to your computer and use it in GitHub Desktop.
/**
* Display a list of upcoming events with Event Organiser
*
* Snippet that produces a simple list of the next 5 upcoming events.
*/
//Get upcoming '
$events = eo_get_events(array(
'numberposts'=>5,
'event_start_after'=>'today',
'showpastevents'=>true,//Will be deprecated, but set it to true to play it safe.
));
if( $events ){
global $post;
echo '<ul>';
foreach( $events as $post ){
setup_postdata($post);
?>
<li>
<a href='<?php the_permalink() ?>'> <h5><?php the_title(); ?></h5></a>
on <?php eo_get_the_start('jS F Y'); ?>
<p><?php the_excerpt(); ?></p>
</li>
<?php
}
echo '</ul>';
wp_reset_postdata();
}else{
echo 'No Upcoming Events';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment