Conditional Placeholders
A conditional placeholder wraps part of a format and shows it only when a condition is true. It is written like an HTML tag with curly braces, with a closing tag that repeats the name after a slash:
{has_image}#_EVENTIMAGE{/has_image}
{no_image}<img src="/path/to/default.png" alt="#_EVENTNAME">{/no_image}
An event with an image prints its image. An event without one prints the default image. When a condition is false, everything between the two tags is removed, including the tags.
Conditional placeholders work wherever placeholders work: the formats in Events then Settings then Formatting, the email templates in Events then Settings then Emails, and the format attribute of shortcodes and template tags. Which ones are understood depends on what is being displayed, in the same way as for placeholders: an event format understands the event conditions, a booking email understands the booking conditions and the event conditions, and so on. A condition that isn't understood counts as false, so its content is hidden.
Most conditions come in pairs, one for "is" and one for "is not". There is no "else", so use both halves of a pair as in the example above.
Rows marked Pro need Events Manager Pro. Rows marked with an add-on name need that add-on.
Events
Use these wherever an event is displayed, including booking emails, where they describe the booked event.
General
| Conditional | Shows its content when |
|---|---|
{has_image} | The event has an image. |
{no_image} | The event has no image. |
{is_active} | The event's status is Active. |
{is_cancelled} | The event's status is Cancelled. |
{is_private} | The event is private. |
{not_private} | The event is not private. |
{is_recurrence} | The event is one date of a recurring event. |
{not_recurrence} | The event is not a date of a recurring event. |
{is_recurring} | The event is the recurring event itself, the one that holds the repeat pattern. |
{not_recurring} | The event is not a recurring event. |
{has_att_X} | The event has a value for the custom attribute named X. Replace spaces in the name with underscores: {has_att_Dress_Code} for "Dress Code". |
{no_att_X} | The event has no value for the attribute named X. |
{has_organizers} | Since 7.5 The event has at least one organizer. Organizers must be enabled in the settings. |
{no_organizers} | Since 7.5 The event has no organizer. |
{is_featured} | Pro The event is featured. See Pay to Post. |
{not_featured} | Pro The event is not featured. |
Event times
Bookings
Status numbers: 0 Pending, 1 Approved, 2 Rejected, 3 Cancelled, 4 Awaiting Online Payment, 5 Awaiting Payment. The four attendee conditions are all false for a visitor who is not logged in, so add {not_logged_in} for a message to guests.
RSVP policies
Pro For events with an RSVP policy. The matching placeholders are under RSVP policies.
The conditions about an attendee's own reply, such as {is_rsvp_reply_yes}, belong to bookings. See RSVP replies.
Waitlists
Pro For events that use waitlists. The matching placeholders are under Waitlists.
In Events Manager Pro 3.10 three of these don't test what their names say. {has_waitlist_booking_limit} and {no_waitlist_booking_limit} test the waitlist's total limit, not the per-booking limit, so they behave like {has_waitlist_limit} and its opposite. {no_waitlist_limit} is true when the event has no waitlist at all. For "the waitlist is unlimited", use {no_waitlist_booking_limit} inside {has_waitlist}.
Categories and tags
The closing tag must repeat the opening tag exactly, list included. Names can contain letters, numbers, hyphens and underscores only, which is why a slug or ID is used and not a name with spaces.
Locations
An event can have a physical venue, an online location (a URL, a custom link, a Zoom meeting), both, or neither.
| Conditional | Shows its content when |
|---|---|
{has_location} | The event has a venue or an online location. |
{no_location} | The event has neither. |
{has_location_venue} | The event has a physical venue. |
{no_location_venue} | The event has no physical venue. |
{has_event_location} | The event has an online location. |
{no_event_location} | The event has no online location. |
{has_event_location_X} | The event's online location is of type X: url, custom_link, or with the Zoom add-on zoom_meeting, zoom_webinar or zoom_room. For example {has_event_location_url}. |
{no_event_location_X} | The event's online location is not of type X. |
{is_hybrid} | Since 7.5 The event has both a venue and an online location. See Hybrid and Virtual Events. |
{not_hybrid} | Since 7.5 The event is not hybrid. |
Imported events
Import/Export For events brought in by the Import/Export add-on. Figures such as prices and spaces are as they were at the last import, and a value of zero still counts as "has".
is_imported, not_imported, is_imported_X, not_imported_X, imported_is_public and imported_is_private also work in location formats, along with {has_location_url} for a location whose source gave a URL.
Visitors
These work in event formats and look at the person viewing the page, not at the event.
| Conditional | Shows its content when |
|---|---|
{logged_in} | The visitor is logged in. |
{not_logged_in} | The visitor is not logged in. |
Locations
Use these in location formats, such as the single location page and locations list. They are not read in event formats, where an unknown condition counts as false.
Categories and tags
Use these in category and tag formats only. In an event format, {has_category_image} would be read as "the event is in a category called image".
| Conditional | Shows its content when |
|---|---|
{has_category_image} | The category has an image. In a category format {has_image} does the same. |
{no_category_image} | The category has no image. |
{has_tag_image} | The tag has an image. In a tag format {has_image} does the same. |
{no_tag_image} | The tag has no image. |
{has_events} | The category or tag has upcoming events. |
{no_events} | The category or tag has no upcoming events. |
{has_events_X} | The category or tag has upcoming events of archetype X, such as {has_events_workshop}. |
{no_events_X} | The category or tag has no upcoming events of archetype X. |
Bookings
Use these wherever one booking is displayed, which mostly means booking emails. All the event conditions work there too and test the booked event.
In Multiple Bookings Mode, the email for a whole checkout covers several events, so event conditions have no single event to test. Wrap them in {not_multi_booking}.
Online and in-person access
Since 7.5 For hybrid and virtual events, where each ticket gives in-person access, online access or both.
{booking_in_person}Doors open at #_12HSTARTTIME at #_LOCATIONNAME.{/booking_in_person}
{booking_online}Your link: #_BOOKINGJOINLINK{/booking_online}
RSVP replies
Waitlists
| Conditional | Shows its content when |
|---|---|
{is_waitlist} | Pro The booking is a waitlist reservation, or came from one. |
{not_waitlist} | Pro The booking has nothing to do with a waitlist. |
Signatures
| Conditional | Shows its content when |
|---|---|
{booking_has_unsigned_signatures} | Pro At least one signature field on the booking form or an attendee form is still unsigned. Use it around #_BOOKINGSIGNATUREURL. |
{booking_no_unsigned_signatures} | Pro Nothing is left to sign. |
Multiple bookings
Pro For Multiple Bookings Mode, where one checkout holds bookings for several events.
Nesting conditional placeholders
You can put one conditional placeholder inside another. By default Events Manager reads two levels: an outer condition and one condition inside it.
{has_tag_members}
{logged_in}Members' details: ...{/logged_in}
{not_logged_in}<a href="/login/">Log in</a> to see more.{/not_logged_in}
{/has_tag_members}
A third level is not read. Its content is dropped from the page with no error message, even when its condition is true:
{has_bookings}
{bookings_open}
{has_time}Starts at #_EVENTTIMES{/has_time}
{/bookings_open}
{/has_bookings}
To avoid a third level, move the innermost block outside one of the others. If you do need deeper nesting, raise the limit in wp-config.php. Each extra level adds a little work every time a format is displayed.
define( 'EM_CONDITIONAL_RECURSIONS', 3 );
Two more limits apply:
- A condition can't be nested inside itself.
{has_image}inside another{has_image}closes at the first{/has_image}. - Category and tag formats read one level only, whatever the setting.
Add your own
A developer can add conditions with the em_event_output_show_condition filter (and the matching em_location_, em_category_, em_tag_ and em_booking_ filters). See the tutorial Creating Conditional Placeholders for Events.