Skip to main content

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​

ConditionalShows 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​

ConditionalShows its content when
{all_day} The event is an all-day event.
{not_all_day} The event is not an all-day event.
{has_time} The event is not all-day and its start and end times differ.
{no_time} The event is not all-day and its start and end times are the same.
{is_long} The event ends on a later date than it starts.
{not_long} The event starts and ends on the same date.
{is_future} The event has not started yet.
{is_current} The event has started and has not ended.
{is_past} The event has ended. If Are current events past events? is set to Yes in Events then Settings then Pages, an event counts as past as soon as it starts.
{same_timezone} The event's timezone is the same as the site's.
{different_timezone} The event's timezone differs from the site's.

Bookings​

ConditionalShows its content when
{has_bookings} Bookings are enabled for the event, whether or not any spaces are left.
{no_bookings} Bookings are not enabled for the event.
{bookings_open} Bookings are enabled, the booking cut-off has not passed, the event is not cancelled, and there are spaces a visitor can book.
{bookings_closed} Bookings are enabled but the event can't be booked right now, for any of the reasons above.
{has_spaces} Bookings are enabled and at least one space is left. This looks at the count only, not at whether the current visitor may book it (a members-only ticket, for example).
{fully_booked} Bookings are enabled and no spaces are left.
{is_free} No ticket has a price above zero. Also true for an event without bookings.
{not_free} Bookings are enabled and at least one ticket has a price above zero.
{is_free_now} No ticket that is on sale right now has a price above zero.
{not_free_now} At least one ticket on sale right now has a price above zero.
{is_user_attendee} The visitor is logged in and has a booking for the event, in any status.
{not_user_attendee} The visitor is logged in and has no booking for the event.
{is_user_attendee_X} The visitor is logged in and has a booking in one of the listed statuses. X is a status number or several separated by commas: {is_user_attendee_1} for approved, {is_user_attendee_0,5} for pending or awaiting payment.
{not_user_attendee_X} The visitor is logged in and has no booking in any of the listed statuses.

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.

ConditionalShows its content when
{has_rsvp_policy} The event has an RSVP policy.
{no_rsvp_policy} The event has no RSVP policy.
{is_rsvp_policy_open} The event's policy type is Open.
{is_rsvp_policy_flexible} The event's policy type is Flexible.
{is_rsvp_policy_strict} The event's policy type is Strict.
{is_rsvp_policy_active} The policy is currently being enforced for the event.

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.

ConditionalShows its content when
{has_waitlist} The waitlist is enabled for the event.
{no_waitlist} The waitlist is not enabled for the event.
{waitlist_open} The waitlist is enabled, the event is fully booked, and the waitlist has room.
{waitlist_closed} The opposite of {waitlist_open}: the waitlist is off, the event still has spaces, or the waitlist is full.
{waitlist_full} The waitlist is enabled, the event is fully booked, and the waitlist has no room left.
{has_waitlist_limit} The waitlist holds a limited number of spaces.
{has_waitlist_expiry} Approved waitlist reservations expire after a set number of hours.
{no_waitlist_expiry} Approved waitlist reservations don't expire.
{has_waitlist_booking_limit} See the note below.
{no_waitlist_booking_limit} See the note below.
{no_waitlist_limit} See the note below.
note

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​

ConditionalShows its content when
{has_category} The event has at least one category.
{no_category} The event has no category.
{has_category_X} The event is in category X, given as a slug or an ID. List several with commas to match any of them: {has_category_music,theater}...{/has_category_music,theater}.
{no_category_X} The event is in none of the listed categories.
{has_tag} The event has at least one tag.
{no_tag} The event has no tag.
{has_tag_X} The event has tag X, given as a slug or an ID. Commas work as for categories.
{no_tag_X} The event has none of the listed tags.
{has_taxonomy} The event has at least one category or tag.
{no_taxonomy} The event has no category and no tag.

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.

ConditionalShows 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".

ConditionalShows its content when
{is_imported} The event was imported.
{not_imported} The event was not imported.
{is_imported_X} The event was imported from source format X, such as {is_imported_ical}.
{not_imported_X} The event was not imported from source format X.
{imported_is_public} The event was imported and is public at its source.
{imported_is_private} The event was imported and is restricted at its source.
{has_event_url} The source gave a URL for the event.
{has_bookings_url} The source gave a URL for bookings.
{no_bookings_url} The source gave no URL for bookings.
{has_bookings_price} The source gave a booking price.
{no_bookings_price} The source gave no booking price.
{has_bookings_spaces} The source gave a number of spaces.
{no_bookings_spaces} The source gave no number of spaces.
{has_bookings_confirmed} The source gave a number of booked spaces.
{no_bookings_confirmed} The source gave no number of booked spaces.

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.

ConditionalShows 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.

ConditionalShows its content when
{has_loc_image} The location has an image.
{no_loc_image} The location has no image.
{has_events} The location has at least one event, past or upcoming.
{no_events} The location has no events.

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".

ConditionalShows 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.

caution

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.

ConditionalShows its content when
{booking_in_person} The booking includes a ticket with in-person access.
{not_booking_in_person} The booking has no in-person access.
{booking_online} The booking includes a ticket with online access.
{not_booking_online} The booking has no online access.
{booking_in_person}Doors open at #_12HSTARTTIME at #_LOCATIONNAME.{/booking_in_person}
{booking_online}Your link: #_BOOKINGJOINLINK{/booking_online}

RSVP replies​

ConditionalShows its content when
{has_rsvp_reply} The attendee has replied.
{no_rsvp_reply} The attendee has not replied.
{is_rsvp_reply_yes} The reply is "Attending".
{is_rsvp_reply_no} The reply is "Not Attending".
{is_rsvp_reply_maybe} The reply is "Maybe Attending".
{is_rsvp_reply_X} The reply has the number X: 0 not attending, 1 attending, 2 maybe.

Waitlists​

ConditionalShows 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​

ConditionalShows 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.

ConditionalShows its content when
{is_multi_booking} This is the checkout as a whole.
{not_multi_booking} This is a booking for one event.
{is_in_multi_booking} This is a booking for one event that was made as part of a checkout.
{not_in_multi_booking} This booking was not part of a checkout.

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.

Two levels: works by default
{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:

Three levels: the innermost line never appears
{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.

wp-config.php
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.