Skip to content

Instantly share code, notes, and snippets.

@huntlyc
Created October 31, 2013 16:25
Show Gist options
  • Save huntlyc/7252633 to your computer and use it in GitHub Desktop.
Save huntlyc/7252633 to your computer and use it in GitHub Desktop.
This example shows how to output an unordered list of all events using the Really Simple Events Plugin (http://wordpress.org/plugins/really-simple-events/)
<?php
/**
* Function documentation for 'hc_rse_get_events($listType, $showEvents = -1, $startdate = -1, $enddate = -1)'
* Depending on the list type, get the events
*
* @param str $listType - [all|all-reverse|upcoming|upcoming-reverse|past|past-reverse]
* @param int $showEvents (optional) - the number of events to show
* @param date $startdate (optional) - date range to start
* @param date $enddate (optional) - date range to finish
* @return $wpdb result set $events - Result set of the query
*/
$events = hc_rse_get_events('all');
?>
<?php if($events): ?>
<ul>
<?php foreach($events as $event): ?>
<?php if($event->link != ''): //show linked event ?>
<li>
<a href="<?php echo hc_rse_display_link($event->link); ?>" title="Details for <?php echo stripslashes($event->title); ?>">
<php echo date('d/m/Y H:i', strtotime($event->start_date)); ?> - <?php echo stripslashes($event->title); ?>
</a>
</li>
<?php else: //show normal event ?>
<li><php echo date('d/m/Y H:i', strtotime($event->start_date)); ?> - <?php echo stripslashes($event->title); ?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment