EE4 Conditional Tags

EE4 Conditional Tags

Conditional tags allow you to control where certain content appears. For example, if you wanted some content to only appear on your single event pages then you could use is_espresso_event_single().

Below are the conditionals that are available for Event Espresso 4.

is_espresso_event_archive()

This conditional checks for the event list page (e.g. http://example.com/events/)

<?php if(is_espresso_event_archive()) {
 echo '<div>This is a test for is_espresso_event_archive()!</div>';
} ?>

is_espresso_event_single()

This conditional checks for a single event page (e.g. http://example.com/events/my-fun-event/)

<?php if(is_espresso_event_single()) {
 echo '<div>This is a test for is_espresso_event_single()!</div>';
} ?>

is_espresso_event_taxonomy()

This conditional checks for a event category page (e.g. http://example.com/event-category/my-event-collection/)

<?php if(is_espresso_event_taxonomy()) {
 echo '<div>This is a test for is_espresso_event_taxonomy()!</div>';
} ?>

is_espresso_venue_archive()

This conditional checks for the venue list page (e.g. http://example.com/venues/)

<?php if(is_espresso_venue_archive()) {
 echo '<div>This is a test for is_espresso_venue_archive()!</div>';
} ?>

is_espresso_venue_single()

This conditional checks for a single venue page (e.g. http://example.com/venues/my-spectacular-venue/)

<?php if(is_espresso_venue_single()) {
 echo '<div>This is a test for is_espresso_venue_single()!</div>';
} ?>

is_espresso_venue_taxonomy()

This conditional checks for a venue category page (e.g. http://example.com/venue-category/my-venue-collection/)

<?php if(is_espresso_venue_taxonomy()) {
 echo '<div>This is a test for is_espresso_venue_taxonomy()!</div>';
} ?>

is_espresso_event()

This conditional checks the type of $post_id to determine if it is a event.

<?php if(is_espresso_event()) {
 echo '<div>This is a test for is_espresso_event()!</div>';
} ?>

is_espresso_venue()

This conditional checks the type of $post_id to determine if it is a venue.

<?php if(is_espresso_venue()) {
 echo '<div>This is a test for is_espresso_venue()!</div>';
} ?>

Resources: Learn more about WordPress conditional tags


Need more help?

Do NOT follow this link or you will be banned from the site!