Skip to content

Event formatting

24-Jan-11

The syntax of events format is quite simple. Basically, just write your html code in the usual way. Then you can add a number of placeholders corresponding to the data of the event. Some of them are:

  • #_EVENTNAME displays the name of the event
  • #_ADDRESS displays the address
  • #_TOWN displays the town
  • #_EVENTDETAILS (or #_NOTES) displays the details of the event
  • #_EVENTID displays the unique event ID, in case you want some unique identifier
  • #_EXCERPT shows an excerpt of the event (this is the content of #_NOTES untill you place a <!––more––> marker
  • #_LINKEDNAME displays the event name with a link to the event page
  • #_EVENTPAGEURL simply prints the event URL. You can use this placeholder to build your own customised links
  • #_EVENTPAGEURL[xx] prints the event URL for event ID xx
  • #_EDITEVENTLINK inserts a link to the edit event page, only if a user is logged in
  • #_ADDBOOKINGFORM adds a form which allows the visitors to register for an event. The form is displayed only if RSVP is enabled for the given event.
  • #_REMOVEBOOKINGFORM adds a form which allows the visitors to remove their registration for an event. The form is displayed only if RSVP is enabled for the given event.
  • #_ADDBOOKINGFORM_IF_NOT_REGISTERED adds a form which allows the visitors to register for an event. The form is displayed only if RSVP is enabled for the given event and if the user hasn’t registered yet (only possible to detect if the RSVP is for WP registered users only).
  • #_REMOVEBOOKINGFORM_IF_REGISTERED adds a form which allows the visitors to remove their registration for an event. The form is displayed only if RSVP is enabled for the given event and if the user has registered already (only possible to detect if the RSVP is for WP registered users only).
  • #_CONTACTNAME displays the name of the event contact person
  • #_CONTACTEMAIL displays the e-mail of the event contact person
  • #_CONTACTPHONE displays the phone of the event contact person
  • #_EVENTCATEGORIES displays a comma-separated list of categories an event is in
  • #_DIRECTIONS displays a small form so you can ask for driving directions to an event/location
  • #_ICALLINK displays a link for an ICAL representation of the event
  • #_ICALURL simply prints the ICAL URL. You can use this placeholder to build your own customised links
  • #_PAST_FUTURE_CLASS returning a string that indicates wether this event is in the future or not (eme-future-event or eme-past-event), can be used as extra CSS to the event list
  • #_RESERVEDSPACES (or #_BOOKEDSEATS) gives the number of seats registered in total for an event
  • #_AVAILABLESPACES (or #_AVAILABLESEATS) gives the number of seats free for an event
  • #_TOTALSPACES (or #_TOTALSEATS) gives the number of seats in total for an event
  • #_USER_RESERVEDSPACES (or #_USER_BOOKEDSEATS) gives the number of seats a users has registered for an event (works only for logged in users of course)
  • #_ATTENDEES will return a html-list of names attending the event (formatted via the setting “Attendees list format”)
  • #_LATITUDE and #_LONGITUDE return the langitude and longitude for the location of the event (if present)
  • #_CALENDAR_DAY returns the day being viewed when viewing a specific day on the calendar
  • #_PRICE or #_EVENTPRICE returns the price of an event (if any)
  • #_PRICExx or #_EVENTPRICExx (with xx being a number) returns the xx-th price of a multi-price event (if any). E.g.: #_PRICE3
  • #_CURRENCY returns the currency of an event (if any)
  • #_RECURRENCEDESC shows the recurrence info for an event like it does in the admin backend
  • #_CURRENCY returns the currency of an event (if any)
  • #_EVENTIMAGE returns the featured image for the event (if any)
  • #_EVENTIMAGEURL returns just the url to the featured image of the event, if you want to create your own links or smaller image or so
  • Location placeholders Every location placeholder can be used inside an event as well, see the doc for location placeholders

If you have enabled the Google Map integration, you can use #_MAP to display a map. It is also possible to use #_MAP in the events list page.

Time placeholders

To add temporal information about the events, use PHP syntax format characters with a # before them. For example:

  • #d displays the day of the month, with 2 digits with leading zeros
  • #m displays the short textual representation of a month, three letters (jan through dec)
  • etc

To display the event end time use the PHP syntax format characters with a #@ before them (e.g.: #@h or #@i).

If you have problems with the date shortcodes because they get interpreted wrong, like e.g. when you use
#Y#dT#m (“T” just stands for the letter T)
it will try to interpret #dT and not #d followed by “T”. To get around this, use the following notation using curly brackets:
#_{Y}#_{d}T#_{m} or, shorter (just use curly brackets when there is a possibility it gets interpreted wrong, and you can put more php date notations in curly brackets:
#_{Yd}T#m.
The same goes for end dates: #@_{Yd}T#_{m}.
Other example, for easier formatting: #_{d/m/Y}

Some users with older PHP/MySQL versions cannot display time properly through the aforementioned placeholders. They are advised to use the following premade time placeholders:

  • #_24HSTARTTIME displays the start time in a 24 hours format (ex: 16:30)
  • #_24HENDTIME displays the end time in a 24 hours format (ex: 18:30)
  • #_12HSTARTTIME displays the start time in a 12 hours format (ex: 4:30 PM)
  • #_12HENDTIME displays the start time in a 12 hours format (ex: 6:30 PM)

URL escaping

All the placeholders mentioned above can be url-escaped, so you can use them in any url if wanted (eg. see the FAQ section: How to add a “Add to Google Calendar” link to an event). Just prefixing by #URL is enough: #URL_NAME, #URL_EVENTPAGEURL, etc …