[EventCalendar] Customising ec3_get_events display

Rick Boatright rboatright at gmail.com
Mon Dec 22 01:50:16 UTC 2008

it does matters, since 3.2 has all these spiffy neato additional functions
that 3.1.4 didn't have.
function ec3_get_version()
Get the current version of the EC3 plug-in.

## Query functions.

These functions all get information about the current query. They all have a
version that operates on the current Wordpress query, and another version
that takes a query parameter.

function ec3_is_event_category()
function ec3_is_event_category_q(&$query)
Returns TRUE if the query is an event category query.

function ec3_get_listing()
function ec3_get_listing_q(&$query)
Determines the type of listing for the query -
When $query->ec3_listing the result is A or E, depending upon the query.

## Current post/event functions.

These functions all get information about the current post or current event.
You must be inside a loop in order to use them. They all return their
result, so if you want to echo it to the page, you must call 'echo'

function ec3_is_event()
Returns TRUE if the current post is an event. Most of the rest of the
post/event functions are meaningless if this returns FALSE.

function ec3_get_sched_id()
Get the sched_id of the current event.

function ec3_is_past()
Return TRUE if the current event is in the past.

function ec3_get_since()
Get a human-readable 'time since' the current event.

### Start/End time functions.

These all get the start or end time of the current event or current
event-post. If the current post has no events, then they return an empty
string. The end time of an event-post is the end time of the post's last
scheduled event.

All of these functions take an optional 'date format' parameter which allows
you to customise the output format. The only difference between most of the
functions is the default date format.

function ec3_get_start_time($d='')
function ec3_get_end_time($d='')
These functions use Wordpress' 'time_format' setting.

function ec3_get_start_date($d='')
function ec3_get_end_date($d='')
These functions use Wordpress' 'date_format' setting.

function ec3_get_start_month($d='F Y')
function ec3_get_end_month($d='F Y')
These functions default to 'month year' format. E.g. 'May 2009'.

function ec3_get_time($d='')
function ec3_get_month($d='')
function ec3_get_date($d='')
These are just shorthand for ec3_get_start_time() etc.

function ec3_cmp_events(&$e0,&$e1)
Comparison function for events' start times.

## Event Loop Functions

function ec3_iter_post_events($id=0)
Initialise an event-loop, just for the events in the current $post.
   // First a normal loop over the current query's posts.
     // Now a nested loop, over the events in each post.
     for($evt=ec3_iter_post_events(); $evt->valid(); $evt->next())

function ec3_iter_all_events()
function ec3_iter_all_events_q(&$query)
Initialise an event-loop, for ALL events in all posts in the query.
     for($evt=ec3_iter_all_events(); $evt->valid(); $evt->next())

function ec3_reset_wp_query()
Resets the global $post status from $wp_query. Allows us to continue with
the main loop, after a nested loop. */

### Event Iterator class

The ec3_EventIterator class implements loops over events. Generated by
ec3_iter_post_events() or ec3_iter_all_events(). These iterators are not
independent - don't try to get smart with nested loops! This class is ready
to implement PHP5's Iterator interface.

class ec3_EventIterator
 /** Resets this iterator to the beginning. */
 function rewind()

 /** Move along to the next (possibly empty) event. */
 function next()

 /** Returns TRUE if this iterator points to an event. */
 function valid()

 /** Set the current event (global $ec3->event) to match this iterator's
  *  index. */
 function current()

 /** Returns the current index. */
 function key()

... Just the Javadoc style comments from here:

/** Formats the schedule for the current post.
 *  Returns the HTML fragment as a string. */
function ec3_get_schedule(
 $format_single =EC3_DEFAULT_FORMAT_SINGLE,
 $format_range  =EC3_DEFAULT_FORMAT_RANGE,

/** Formats the schedule for the current post as one or more 'iconlets'.
 *  Returns the HTML fragment as a string. */
function ec3_get_iconlets()

/** Template function, for backwards compatibility.
 *  Call this from your template to insert the Sidebar Event Calendar. */
function ec3_get_calendar($options = false)

On Sun, Dec 21, 2008 at 7:18 PM, James Kirsop <james.kirsop at gmail.com>wrote:

> I've just downloaded the latest version of EC (3.2), not that it matters
> too much on which version I'm using, but I'm just curious to know if there's
> a simple way of customising the output of ec3_get_events() to make it look
> more pretty, with more information.
> Or, is there a way of ordering posts output by the general Wordpress loop
> in an order dictated by their event dates set in ec3?. Running the
> usual/standard wordpress loop doesn't help much, as they just appear in the
> date order that they were posted in -- which is not what I'm looking for.
> Ideally, I'd like to have pagination working, which isn't covered by
> ec3_get_events() but is covered by the WP loop.
> Thanks,
> James
> _______________________________________________
> Blog: http://wpcal.firetree.net/
> EventCalendar at firetree.net mailing list
> Unsubscribe: http://penguin.firetree.net/eventcalendar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://penguin.firetree.net/pipermail/eventcalendar/attachments/20081221/db27790a/attachment.html

More information about the EventCalendar mailing list