Shortcodes & Template Variables for Event Espresso 3

Shortcodes & Template Variables for Event Espresso 3

Overview

This is a list of shortcodes and template variables used in Event Espresso.

Single Events

Displays a single event on a page or post.
Please note that the “your_event_identifier” parameter uses the Unique Event Identifier which is found under the event title in the editor screen, and not the event ID.

[SINGLEEVENT single_event_id="your_event_identifier"]

Important:

Do not replace the [ESPRESSO_EVENTS] shortcode with the [SINGLEEVENT] shortcode.


The “Shortcode” button in the event editor will generate this shortcode for you. Copy and paste the generated shortcode onto a page or post to display a single event on a page or post.




Add Events to Cart

Displays an “Add Event to Cart” link that can be added to the event details, page, or post. Requires the Multiple Event Registration add-on.

[ESPRESSO_CART_LINK event_id="1" anchor="Register for This Event"]

(Adds a “Register for This Event” link which adds the selected event to the cart.)

[ESPRESSO_CART_LINK event_id="1-2-3" anchor="Register for These Events"]

(Adds events with the event IDs of 1, 2 & 3 to the cart.)

Additional Examples:

[ESPRESSO_CART_LINK direct_to_cart=1 moving_to_cart="Redirecting to cart..."]

(Used to redirect to the shopping cart page. Must be added to an event description.)

[ESPRESSO_CART_LINK event_id="add_event_id_here" direct_to_cart=1 moving_to_cart="Redirecting to cart..."]

(Same as above, but uses the event_id parameter and can be added to a page or post.)




Event List

Returns a list of events

[EVENT_LIST]
[EVENT_LIST limit=1]
[EVENT_LIST show_expired=true]
[EVENT_LIST show_deleted=true]
[EVENT_LIST show_secondary=true]
[EVENT_LIST show_recurrence=true] (for recurring events)
[EVENT_LIST category_identifier=your_category_identifier]
or
[EVENT_LIST event_category_id=your_category_identifier]
[EVENT_LIST events_per_page=10] (adds pagination to the event list)
[EVENT_LIST order_by=date(start_date),id]
[EVENT_LIST sort=DESC] sort in a descending order - must be used in conjunction with order_by
examples: order_by=start_date -or- order_by=event_name
[EVENT_LIST sort=ASC] sort in an ascending order - must be used in conjunction with order_by
[EVENT_LIST staff_id="1"] show only events assigned to a staff member (number is staff members ID)
[EVENT_LIST css_class=my-custom-class] adds a class to every event so you can style event lists differently. just change the "my-custom-class" to your actual CSS class.

Multiple categories can be used by adding a comma separated list, e.g. [EVENT_LIST category_identifier=”category1, category2, category n”] (as of version 3.1.30 and beyond)

Order by parameters:
(comma separated)

id
date(start_date)
date(end_date)
time(start_time)
time(end_time)
event_name
date(registration_start)
date(registration_end)
city
state
category_id
venue_title
Important:

The [EVENT_LIST] shortcode should not be used as a replacement for the [ESPRESSO_EVENTS] shortcode. Replacing the [ESPRESSO_EVENTS] shortcode will break your registration pages. If you use the [EVENT_LIST] shortcode please use it on a new page. Then what you can do is hide the page with the [ESPRESSO_EVENTS] shortcode from the site’s navigation menu.




Creates an autocomplete search tool.

[EVENT_SEARCH]




Attendee Numbers

Display the amount of attendees and/or registration limit

[ATTENDEE_NUMBERS event_id=1 type=reg_limit]

Available parameters:
event_idrequired
typerequired

Available types
available_spaces = returns the number of available spaces
num_attendees = returns the number of attendees
reg_limit = returns the total number of spaces
num_incomplete = returns the number of incomplete (non paid) registrations
num_completed = returns the number of completed (paid) registrations
num_completed_slash_incomplete = returns the number of completed and incomplete registrations separated by a slash (eg. 3/1)
num_attendees_slash_reg_limit = returns the number of attendees and the registration limit separated by a slash (eg. 4/30)

Template Code:

<?php echo do_shortcode('[ATTENDEE_NUMBERS event_id="'.$event_id.'" type="num_attendees"]');?> / <!?php echo do_shortcode('[ATTENDEE_NUMBERS event_id="'.$event_id.'" type="reg_limit"]');?>




Attendee Events

[ESPRESSO_MY_EVENTS]

This shortcode is part of the WP User Integration (version 1.9.5 onwards) and should be used on a page or post and displays the current and past events for the logged in user.




Edit Profile

[ESPRESSO_EDIT_PROFILE]

Using this shortcode you can allow a logged in user to edit their profile from the front end of your website.




Event price

Number is the number of the result you want to display. For example: 0 is the first instance of the price array, 1 would be the second price in the array.

[EVENT_PRICE event_id=1 number=0]

Template Code:

<?php echo do_shortcode('[EVENT_PRICE event_id="'.$event_id.'" number="0"]');?>




Registration Page

Show an entire registration form for an event.

[ESPRESSO_REG_PAGE event_id=1]

Template Code:

<?php echo do_shortcode('[ESPRESSO_REG_PAGE event_id="'.$event_id.'"]');?>




Registration Form

Adds a registration form to a page, post or custom post type.

[ESPRESSO_REG_FORM event_id=1]




Event Category

[CATEGORY_NAME event_id=1]

Template Code:

<?php echo do_shortcode('[CATEGORY_NAME event_id="'.$event_id.'"]');?>




Attendee Listings

Use on a post or page

[LISTATTENDEES]
[LISTATTENDEES limit="30"] //Number of events to show on the page
[LISTATTENDEES paid_only="true"] //Show completed and pending registrations only
[LISTATTENDEES show_expired="true"] //Show expired events
[LISTATTENDEES show_deleted="true"] //Show deleted events
[LISTATTENDEES show_secondary="true"] //Show secondary/backup events
[LISTATTENDEES show_gravatar="true"] //Show a Gravatar of the attendee
[LISTATTENDEES show_recurrence="false"] //Exclude recurring events
[LISTATTENDEES event_identifier="your_event_identifier"] //Show a single event using the event identifier
[LISTATTENDEES category_identifier="your_category_identifier"] //Show a group of events in a category using the category identifier

Example CSS for your themes style sheet:

li.attendee_details{
    display:block;
    margin-bottom:20px;
    background: #ECECEC;
    border:#CCC 1px solid;
}
.espresso_attendee{
    width:400px;
    padding:5px;
}
.espresso_attendee img.avatar{
    float:left;
    padding:5px;
}
.clear{
    clear:both;
}




Venue Shortcodes


Event Description Example: If you want to display venue details within an event, the venue id is not needed. Just add [ESPRESSO_VENUE] to your event description.

Example with Optional Parameters:

[ESPRESSO_VENUE outside_wrapper="div" outside_wrapper_class="event_venue"]

Page/Post Example: You can display the details of any venue to a page, post or event by adding the id of the venue to the shortcode.

[ESPRESSO_VENUE id="3"]

Page/Post Example #2: If you want to display a the details of a venue on a page, post or event add the event id to the

[ESPRESSO_VENUE]

shortcode.

[ESPRESSO_VENUE event_id="8"]

Available parameters:

outside_wrapper_class = class name for the outside wrapper. Eg. event_venue
outside_wrapper = outside wrapper element. Eg. div
inside_wrapper_class = class name for the outside wrapper. Eg. venue_details
inside_wrapper = inside wrapper element. Eg. p
title_class = class name for the title Eg. venue_name
title_wrapper = title wrapper element. Eg. h3
show_title = show the venue name? (true|false default true)
image_class = class name for the image. Eg. venue_image
show_image = show the image? (true|false default true)
show_description = show the description? (true|false default true)
show_address = show the address of the venue? (true|false default true)
show_additional_details = show the additional details? (true|false default true)
show_google_map_link = show the Google map link? (true|false default true)
map_link_text = text to display in the link. Eg. Map and Directions
show_map_image (true|false default true)
map_image_wrapper
map_image_class
map_w (map image width default 400)
map_h (map image height default 400)




Venue List

[ESPRESSO_VENUE_EVENTS id=1]

Displays a list of events that are assigned to a single venue. Use the venue ID. You can use the same parameters that the [EVENT_LIST] shortcode supports.

Important:

The [ESPRESSO_VENUE_EVENTS] shortcode should not be used as a replacement for the [ESPRESSO_EVENTS] shortcode. Replacing the [ESPRESSO_EVENTS] shortcode will break your registration pages. If you use the [ESPRESSO_VENUE_EVENTS] shortcode please use it on a new page. Then what you can then do is hide the page with the [ESPRESSO_EVENTS] shortcode from the site’s navigation menu.




Staff Shortcodes

Event Description Example:
If you want to display a list of staff members within an event, the staff id is not needed. Just add [ESPRESSO_STAFF] to your event description.

Example with Optional Parameters:

[ESPRESSO_STAFF outside_wrapper="div" outside_wrapper_class="event_staff" inside_wrapper="p" inside_wrapper_class="event_person"]

Page/Post Example:
You can display the details of any staff member to a page, post or event by adding the id of the staff member to the shortcode.

[ESPRESSO_STAFF id="3"]

Page/Post Example #2:
If you want to display a list of staff members assigned to an event, to a page, post or event add the event id to the [ESPRESSO_STAFF] shortcode.

[ESPRESSO_STAFF event_id="8"]

Template Example:
If you want to automate this process, you can add the following to your event_registration_display.php file and it will display every staff member attached to that event.

<?php echo do_shortcode('[ESPRESSO_STAFF event_id="' . $event_id . '"]'); ?>

Available parameters:

outside_wrapper_class = class name for the outside wrapper. Eg. event_staff
outside_wrapper = outside wrapper element. Eg. div
inside_wrapper_class = class name for the outside wrapper. Eg. event_person
inside_wrapper = inside wrapper element. Eg. p
name_class = class name for the persons name
name_wrapper = name wrapper element. Eg. strong
image_class = class name for the image. Eg. venue_image
show_image = show the persons image? (true|false default true)
show_staff_titles = show the persons title? (true|false default true)
show_staff_details = show the details? (true|false default true)
show_staff_roles = show the persons role (true|false default true)
show_description = show the description? (true|false default true)




Calendar Shortcodes

[ESPRESSO_CALENDAR]
[ESPRESSO_CALENDAR show_expired="true"]
[ESPRESSO_CALENDAR event_category_id="your_category_identifier"]
[ESPRESSO_CALENDAR event_category_id="your_category_identifier" show_expired="true"]
[ESPRESSO_CALENDAR cal_view="month"] (Available parameters: month, basicWeek, basicDay, agendaWeek, agendaDay)




Category Shortcodes

[EVENT_ESPRESSO_CATEGORY event_category_id="your_category_indentifier"]

(can be replaced with

[EVENT_LIST category_identifier=your_category_identifier]

)

Important:

The [EVENT_ESPRESSO_CATEGORY] shortcode should not be used as a replacement for the [ESPRESSO_EVENTS] shortcode. Replacing the [ESPRESSO_EVENTS] shortcode will break your registration pages. If you use the [EVENT_ESPRESSO_CATEGORY] shortcode please use it on a new page. Then what you can then do is hide the page with the [ESPRESSO_EVENTS] shortcode from the site’s navigation menu.





Times and Dates

[EVENT_TIME event_id=1 type=start_date format=F jS]

event_id (required)
type ( start_date_time (default) | end_date_time | start_time | end_time | start_date | end_date | start_timestamp | end_timestamp )
format (optional) the format of the date or time.
Please refer to http://php.net/manual/en/function.date.php for date/time formats

Template Code:

<?php echo do_shortcode('[EVENT_TIME event_id="'.$event_id.'" type="start_date" format="F jS"]'); ?>




EE Meta boxes

Event meta boxes allow you to add extra information to your event that you can display in your templates or use in your custom pages. The name parameter is the the first box labeled ‘Key’ and allows the shortcode to identify which meta box is to be displayed; the ‘Value’ is the actual content you wish to be shown.

Shortcodes

This extra information can be displayed in your event listings or registration pages via shortcodes added to the event description. The Shortcodes take the form of:

[EE_META type='event_meta' name='my_meta_key']

If you are using custom templates (moved to the uploads folder) you can add the shortcode directly to the template, this would take the form of:

echo do_shortcode('[EE_META type="event_meta" name="my_meta_key"]');

Adding default meta key/values

To add default meta values, modify and copy the following example code to the custom_functions.php file that is included with the custom files add-on:

if (!function_exists('ee_default_event_meta')){
    function ee_default_event_meta(){
        return array(
            "event_hashtag"=>"#eventespresso",
            "event_format"=>"conference",
            "event_livestreamed"=>"N"
        );
    }
}




Custom Field Variables

$event_identifier = get_post_meta($post->ID, 'event_identifier', true);
$event_id = get_post_meta($post->ID, 'event_id', true);
$event_start_date = get_post_meta($post->ID, 'event_start_date', true);
$event_end_date = get_post_meta($post->ID, 'event_end_date', true);
$event_location = get_post_meta($post->ID, 'event_location', true);
$event_address = get_post_meta($post->ID, 'event_address', true);
$event_address2 = get_post_meta($post->ID, 'event_address2', true);
$event_city = get_post_meta($post->ID, 'event_city', true);
$event_state = get_post_meta($post->ID, 'event_state', true);
$event_country = get_post_meta($post->ID, 'event_country', true);
$event_phone = get_post_meta($post->ID, 'event_phone', true);
$event_externalURL = get_post_meta($post->ID, 'event_externalURL', true);
$event_registration_start = get_post_meta($post->ID, 'event_registration_start', true);
$event_registration_end = get_post_meta($post->ID, 'event_registration_end', true);

For more information on the get_post_meta function, check out this page:
http://codex.wordpress.org/Function_Reference/get_post_meta


Need more help?

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