ec3_get_events()

Inserts a list of the next few upcoming events. The formatting of the list is highly configurable.

Simple Example: Add this code to your sidebar.php

<li>Events <?php ec3_get_events(5); ?> </li>

Parameters:

$limit
The maximum number of future events or days to list. You can enter a plain number, which limits the number of events, or you can enter a string like '7 days' which shows all events for the next week.

$template_event (OPTIONAL)
DEFAULT=”<a xhref=’%LINK%’>%TITLE% (%TIME%)</a>”.
A template for the formating of each event. The following placeholders are
available:

  • %TITLE% – the title of the event.
  • %LINK% – the URL of the event post.
  • %TIME% – the time of the event.
  • %AUTHOR% – the post’s author.

$template_day (OPTIONAL)
DEFAULT=”%DATE%:”.
A template for the formatting of a header for each day. If you don’t want this header, then set this to an empty string. The following placeholders are available:

  • %DATE% – The date of the post.
  • %SINCE% – Time until the event (Only available when Dunstan’s ‘Time Since’ plugin is active).

$date_format (OPTIONAL)
DEFAULT=”j F”.
A PHP date format string used to calculate the value of %DATE%. If this option is set empty, then WordPress’ normal date format is used.

$template_month (OPTIONAL)
DEFAULT=””.
A template for the formatting of a header for each month. If you don’t want this header, then set this to an empty string. The following placeholders are available:

  • %MONTH% – The month of the post.

$month_format (OPTIONAL)
DEFAULT=”F Y”.
A PHP date format string used to calculate the value of %MONTH%.

Example 1. No special headers:

<li>Events <?php
ec3_get_events(
   '7 days',                               // limit
   '%DATE%: <a href="%LINK%">%TITLE%</a>', // template_event
   ''                                      // template_day
);
?></li>

2 January: First event.
5 January: Second event.
5 January: Third event.

Example 2. Date header (default set up):

<li>Events <?php
ec3_get_events(
   4,                                      // limit
   '<a href="%LINK%">%TITLE% (%TIME%)</a>',// template_event
   '%DATE%:',                              // template_day
   'j F'                                   // date_format
);
?></li>

2 January:
  First event. (10:00)
5 January:
  Second event. (09:00)
  Third event. (12:00)
14 February:
  Fourth event. (all day)

Example 3. Month header:

<li>Events <?php
ec3_get_events(
   4,                                      // limit
   '%DATE%: <a href="%LINK%">%TITLE%</a>', // template_event
   '',                                     // template_day
   'j',                                    // date_format
   '%MONTH%:'                              // template_month
);
?></li>

January 2006:
  2: First event.
  5: Second event.
  5: Third event.
February 2006:
  14: Fourth event.

Leave a Reply