Skip to content

Templates API

24-Jan-11

If you’re into theming, you should probably use the template tags provided by Events Made Easy. The following tags insert event-related elements into your templates

eme_get_events_list(args)

Prints or returns a list of the events. Accepts optional arguments, specified in a string ("key=value&key=value etc). See the documentation concerning the [events_list] shortcode for a list of all possible parameters.
Example:

<ul>
<?php eme_get_events_list("limit=5&scope=all&order=DESC"); ?>
</ul>
The above code will print a list of the latest 5 events, including past ones, in a descendant order.
<ul>
<?php eme_get_events_list("limit=0&category=1,4&period=monthly&order=ASC"); ?>
</ul>

The above code will print a list of all events of category 1 and 4 using monthly paging.

eme_get_calendar()

Prints the current month calendar, highlighting any event and linking to it. Accepts the following optional arguments, specified in a string ("key=value&key=value etc).

  • full indicates you want to show the large calendar, don’t use this in sidebar widgets. Defaults to 0.
  • month indicates the month you wish to display. Defaults to the current month.
  • year indicates indicates the year the calendar will use to display a month of. Defaults to the current year.
  • long_events: if set to 0, events will only be shown on their startdate, if 1 events spanning multiple days will be shown on each of those days. Defaults to 0.
  • category limits the events shown to those of a certain category ID. You can also use OR and AND for multiple categories: “1,3″ (category 1 OR 3) or “1+3″ (category 1 AND 3)
  • location_id limits the events shown to those of a certain location ID. You can also use OR and AND for multiple locations: “1,3″ (location 1 OR 3) or “1+3″ (location 1 AND 3)
  • contact_person limits the events shown to those of a certain contact person (loginname). You can specify multiple contact persons for OR limitations: “admin,admin2″ for events whose contact persons are user admin OR user admin2

Example:

<ul>
<?php eme_get_calendar("full=1&month=8&long_events=1"); ?>
</ul>

eme_get_events_page(justurl)

Prints a link to the events page. If you set the optional justurl property to true, the function only prints the URL of the events page.

eme_rss_link(args)

Prints a link to the events RSS feed. Accepts a number of parameters, most of them identical to those of eme_get_events_list():

  • justurl If you set this property to true, the function only prints the RSS URL.
  • limit indicates the maximum number of events to display. Default is 10. If you give the value “0″ there’s no limit.
  • scope lets you choose which events to show: Choose between today, this_month, next_month, future, past, all, 0000-MM (for the events of a specific month), YYYY-MM-DD (for the events on a single day) or YYYY-MM-DD--YYYY-MM-DD (for the events in a certain period) events. Default is future.
  • order indicates indicates the order of the events. Choose between ASC (ascendant, default) and DESC (descendant).
  • echo indicates whether the list should be printed (true) or just returned (false). This option should be ignored, unless you know what you are doing.
  • category limits the events shown to those of a certain category ID. You can specify multiple categories for AND and OR limitations: “1,3″ for events in category 1 OR 3, “1+3″ for events in category 1 AND 3
  • author limits the events shown to those of a certain author (loginname). You can specify multiple authors for OR limitations: “admin,admin2″ for events created by user admin OR user admin2

eme_ical_link(justurl)

Prints a link to the events ICAL feed. If you set the optional justurl property to true, the function only prints the ICAL URL.

Conditional template tags

These tags return true or false, and are useful to structure your themes.

eme_are_events_available(scope)

Returns true if events are available in scope. The default value of scope is future.

eme_is_events_page()

Returns true if the page loaded corresponds to the events page.

eme_is_single_event_page()

Returns true if the page loaded corresponds to a single event page.

eme_is_multiple_events_page()

Returns true if the page loaded corresponds the multiple events page.

eme_is_event_rsvpable()

Returns true if the RSVP is activated for an event in a single event page.