Function API

If you’re into theming or you need to write some extra filters/hooks, you should probably use some function calls provided by Events Made Easy. Below you find some of the more relevant calls.

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 No events 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.

eme_get_person_by_post()

Returns the person based on the rsvp info entered. This can then be used for example to see if he already registered.

eme_get_booking_ids_by_email_event_id($email,$event_id)

Returns all existing booking ids for a specific event id and email.

eme_get_booking_ids_by_person_event_id($person_id,$event_id)

Returns all existing booking ids for a specific event id and person id.

eme_get_booking_ids_by_wp_event_id($wp_id,$event_id)

Returns all existing booking ids for a specific event id and wordpress user ID.

eme_wordpress_search_events()

Since events aren’t posts, they are not shown by default in your search result. But by using a child theme and changing some lines in your theme’s search.php, you can shown them in any way you want.
So, create a child theme and edit search.php there.
At the beginning of search.php, add this line:

$events = eme_wordpress_search_events();

In EME before version 1.7.11, this is called just eme_wordpress_search() and will be available as backwards compatibility function call.
Further down in search.php, change:

<?php if ( have_posts() ) : ?>

to:

<?php if ( have_posts() || !empty($events) ) : ?>

And then, just above the call for

<?php while ( have_posts() ) : the_post(); ?>

(or wherever you want it), add something like this:

<?php foreach ($events as $event) {
   print "<h2><a href='".eme_event_url($event)."'>".$event['event_name']."</a> ".$event['event_start_date']."</h2>";
   print substr($event['event_notes'],0,250)."[...]";
   print "<div style='clear:both;'></div>";
} ?>

You can even use shortcodes here, but I suggest to keep things simple …
The function eme_wordpress_search_events also takes 1 parameter, namely the scope of the events to search in. By default the scope is “future”, but you can also specify “past” or “all”:

$events = eme_wordpress_search_events("all");

eme_get_* functions

EME has many functions to get e.g. an event, location, category, template, membership, member, etc …
All these follow the same logic: give as argument the event/location/category id, the result is an array representing the event, location, …
Example:

$event = eme_get_event($event_id);

Custom field functions

An event can have custom fields, but the eme_get_event function doesn’t return this. Use the function eme_get_event_cf_answers for this.
Example:

$answers = eme_get_event_cf_answers($event_id);

There are also the functions eme_get_location_cf_answers, eme_get_person_answers, eme_get_member_answers, eme_get_membership_answers.

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.

Scroll to Top