Custom Post Types – Basic Setup

Event Espresso by default allows you to create an extra Post based on the event contents, should you wish your events to be added to your WordPress content feed.

You can also add events to a custom post type called Events.

In order to do this, you will need access to FTP or your hosts CPanel or Plesk file manager as you will need to move some files around.

Set Up

In the event-espresso directory (wp-content/plugins/event-espresso) is a directory called post-type-samples.

In that directory find and copy the page-event_list.php file to your theme’s directory.

This will allow your theme to recognize that file as a Page Template.

Updates

When you update your theme it is possible that this file will be deleted. Either set up a child theme or make sure you back up the file before updating.

Create a new WordPress Page and in the Page Attributes box on the right select the Espresso Events template.

Now head over to the Event Espresso > Template Settings page and make sure that the option “Use the custom post types feature?” is set to Yes.

Go to the Settings > Permalinks and just press save. What this does is reset the permalink (url) structure so that WordPress knows about the custom post type. If you fail to do this you will find that your links won’t work correctly.

Create a new or edit an existing event and scroll to the bottom where it says Create a Post.

Set the option “Add/Update post for this event?” to Yes and make sure that the “Post Type” option is set to Espresso Events.

Once the Event is published or updated, the new custom post type will appear in its own Events section in the main WordPress menu.

These custom post types can be viewed via the page you set up at the beginning.

Custom Post Types and Registration

The custom post types, just like the normal posts, won’t show the events registration form by default, but there a few ways in which you can add that form in.

Use the single-espresso_event.php file. Copy it over from the post-type-samples directory to your themes root directory just like you did with the page-event_list.php file earlier

Add the shortcode [ESPRESSO_REG_FORM event_id=X] to the custom post type manually. X equals the event ID number.

Multiple Event Registration add on:  add the  Add to Cart link in the event manually, which will carry over into the custom post type. This will allow users to add to cart direct from that post as well as from the event itself.

Add this to your themes single.php file

$ee_get_post_id = get_the_ID();
$ee_event_id = get_post_meta($ee_get_post_id, event_id, true);
if ($ee_event_id != '') {
echo do_shortcode('[ESPRESSO_REG_FORM event_id=' . $ee_event_id . ']'); 
} else {
// Do nothing
}

Need more help?

  • Browse or search for more information on this topic in our support forums. Customers with an active support license can open a support topic and get help from Event Espresso staff.
  • Have an emergency? Purchase a support token and get expedited one-on-one help!
  • Go back to documentation for Event Espresso
Event Espresso