Developers Corner:
Custom Post Types in EE4

What are Custom Post Types?

WordPress can hold and display many different types of content. A single item of such a content is generally called a post, although post is also a specific post type. Internally, all the post types are stored in the same place, in the ‘wp_posts‘ database table, but are differentiated by a column called ‘post_type’. A Custom Post Type (CPT) is nothing more than a regular post with a different ‘post_type’ value in the database. The post type of regular posts is post, pages use page, attachments use attachment and so on. More information Custom Post Types can be found at WordPress: http://codex.wordpress.org/Post_Types

By default, Event Espresso provides full-page Event and Venue CPT archives and single page templates.

How are Custom Post Types used in Event Espresso 4?

Custom Post Types allow developers to integrate Event Espresso into your theme and reuse attendee data as you would other post data. This gives developers the ability to create great looking  customizable event designs, by giving you the tools they need to easily integrate EE4 core components into themes and reuse attendee data as you would with other post data (please see our EE4 Custom Post Types documentation for more information).

In addition, the EE4 front-end templating systems provides flexible “template parts” that can be used by theme developers for custom themes. In order to maintain compatibility with more themes, these template parts have only basic styles by default but you can easily make them more fancy with custom CSS (see our Theming in Event Espresso 4 post for more information).

The EE4 specific template parts include:

  • Event Details (description)
  • Event Datetimes
  • Event Tickets
  • Event Venues
  • Event Venue Location
  • Event Venue Detail (excerpt)
  • and more!
Many of the standard custom post type data is also available via standard WordPress Custom Queries (e.g. featured image, title, comments, etc.).

CPT Types: Events, Venues, and Contacts

All EE4 CPT data includes normal post data including:

  • Title
  • Description
  • Tags
  • Categories
  • Featured Image
  • Commenting
  • Excerpt
  • Custom Fields
  • Slug
  • Author

This data can be queried and displayed in themes along with other post data.

CPT Archive Pages

As with other Custom Post Types, EE4 is packaged with default event archives, single event pages, venue archives, and single venue page templates. You can copy these templates to your theme folder so that the Event Espresso pages inherit your theme’s post page layouts and styles. See our post on Theming in Event Espresso 4 for more information.

Draft Event Pages

Draft events allow you to build your event page over time without publishing it to your website.

We know you can’t always build and publish an event at once. EE4 will allow you to save events as “draft” status so that you can save your progress and return later to edit and publish your event.

EE4 will automatically save the events you have in-progress as “drafts”, plus you can save them as a “draft” as you go.

Schedule Events to be Published

You can even schedule to publish your event at a later date and time.

WordPress enables you to schedule when posts and pages are published. That functionality extends into Event Espresso’s CPT pages so you can announce your event at just the right moment.

Easy Categorization of Events

Do you have several different types of events such as free and paid, conference speakers and breakout sessions, exercise classes of all kinds? EE4 makes it easy categorize your events and allows your attendees to find what they’re looking for faster.

Plugin and Theme Compatibility

Event Espresso 4 offers much better theme compatibility, because all of your EE4 Events, Venues, and Contacts are CPTs. Event Espresso CPTs can also integrate with other CPT plugins such as: Custom Post Type UI, TinyMCE Advanced, Advanced Custom Fields, etc.

Are you a WordPress theme developer? Want to see how Event Espresso 4 integrates with your theme? Request access to the Event Espresso Core (4.0+) GitHub repository and get acquainted with the premier event registration system for WordPress.

We also have additional Event Espresso developer documentation at http://developer.eventespresso.com/.


Related Articles

Share a Reply or Comment

Your email address will not be published. Required fields are marked *

Need help with Event Espresso? Create a support post in our support forums

Do NOT follow this link or you will be banned from the site!
[gravityform id=116 title=false description=false]
<div class='gf_browser_unknown gform_wrapper' id='gform_wrapper_116' ><form method='post' enctype='multipart/form-data' id='gform_116' action='/2014/02/epsresso-brewery-custom-post-types-event-espresso/'> <div class='gform_body'><ul id='gform_fields_116' class='gform_fields top_label form_sublabel_below description_below'><li id='field_116_5' class='gfield gfield_contains_required field_sublabel_hidden_label field_description_below gfield_visibility_visible' ><label class='gfield_label gfield_label_before_complex' >What is your first name?<span class='gfield_required'>*</span></label><div class='ginput_complex ginput_container no_prefix has_first_name no_middle_name no_last_name no_suffix gf_name_has_1 ginput_container_name' id='input_116_5'> <span id='input_116_5_3_container' class='name_first' > <input type='text' name='input_5.3' id='input_116_5_3' value='' aria-label='First name' aria-required="true" aria-invalid="false" placeholder='First name'/> <label for='input_116_5_3' class='hidden_sub_label screen-reader-text'>First name</label> </span> </div></li><li id='field_116_1' class='gfield gfield_contains_required field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' for='input_116_1' >What is your email address so we can follow up with you?<span class='gfield_required'>*</span></label><div class='ginput_container ginput_container_text'><input name='input_1' id='input_116_1' type='text' value='' class='medium' placeholder='hello@example.com' aria-required="true" aria-invalid="false" /></div></li><li id='field_116_2' class='gfield gfield_contains_required field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' for='input_116_2' >Tell us about your concerns below<span class='gfield_required'>*</span></label><div class='ginput_container ginput_container_textarea'><textarea name='input_2' id='input_116_2' class='textarea medium' placeholder='What kind of events are you planning?' aria-required="true" aria-invalid="false" rows='10' cols='50'></textarea></div></li><li id='field_116_6' class='gfield field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' >GDPR Agreement</label><div class='ginput_container ginput_container_checkbox'><ul class='gfield_checkbox' id='input_116_6'><li class='gchoice_116_6_1'> <input name='input_6.1' type='checkbox' value='I consent to have this website store my submitted information so they can respond to my inquiry.' id='choice_116_6_1' /> <label for='choice_116_6_1' id='label_116_6_1'>I consent to have this website store my submitted information so they can respond to my inquiry.</label> </li></ul></div></li><li id='field_116_3' class='gfield gform_hidden field_sublabel_below field_description_below gfield_visibility_visible' ><input name='input_3' id='input_116_3' type='hidden' class='gform_hidden' aria-invalid="false" value='' /></li><li id='field_116_4' class='gfield gform_hidden field_sublabel_below field_description_below gfield_visibility_visible' ><input name='input_4' id='input_116_4' type='hidden' class='gform_hidden' aria-invalid="false" value='https://eventespresso.com/2014/02/epsresso-brewery-custom-post-types-event-espresso/' /></li><li id='field_116_7' class='gfield gform_validation_container field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' for='input_116_7' >Comments</label><div class='ginput_container'><input name='input_7' id='input_116_7' type='text' value='' autocomplete='off'/></div><div class='gfield_description' id='gfield_description_116_7'>This field is for validation purposes and should be left unchanged.</div></li> </ul></div> <div class='gform_footer top_label'> <input type='submit' id='gform_submit_button_116' class='gform_button button' value='Send my message' onclick='if(window["gf_submitting_116"]){return false;} if( !jQuery("#gform_116")[0].checkValidity || jQuery("#gform_116")[0].checkValidity()){window["gf_submitting_116"]=true;} ' onkeypress='if( event.keyCode == 13 ){ if(window["gf_submitting_116"]){return false;} if( !jQuery("#gform_116")[0].checkValidity || jQuery("#gform_116")[0].checkValidity()){window["gf_submitting_116"]=true;} jQuery("#gform_116").trigger("submit",[true]); }' /> <input type='hidden' class='gform_hidden' name='is_submit_116' value='1' /> <input type='hidden' class='gform_hidden' name='gform_submit' value='116' /> <input type='hidden' class='gform_hidden' name='gform_unique_id' value='' /> <input type='hidden' class='gform_hidden' name='state_116' value='WyJbXSIsIjBiNjdjZjkyMDUzOWUxOWY5Y2NiZjIwMzM4YjA1Mjk4Il0=' /> <input type='hidden' class='gform_hidden' name='gform_target_page_number_116' id='gform_target_page_number_116' value='0' /> <input type='hidden' class='gform_hidden' name='gform_source_page_number_116' id='gform_source_page_number_116' value='1' /> <input type='hidden' name='gform_field_values' value='' /> </div> </form> </div><script type='text/javascript'> jQuery(document).bind('gform_post_render', function(event, formId, currentPage){if(formId == 116) {if(typeof Placeholders != 'undefined'){ Placeholders.enable(); }} } );jQuery(document).bind('gform_post_conditional_logic', function(event, formId, fields, isInit){} );</script><script type='text/javascript'> jQuery(document).ready(function(){jQuery(document).trigger('gform_post_render', [116, 1]) } ); </script>