Skip to content

Instantly share code, notes, and snippets.

@lorenzocaum
Last active October 19, 2017 13:27
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lorenzocaum/16aac08f099d7c154f04 to your computer and use it in GitHub Desktop.
Save lorenzocaum/16aac08f099d7c154f04 to your computer and use it in GitHub Desktop.
Steps for setting up new theme templates with Event Espresso 4

Previously, setting up new theme templates were done as a way to rearrange the event elements on the events listing page (e.g. example.com/events/) and the single event page (e.g. example.com/events/my-fun-event/).

There is now a feature that will let you change the order of the event elements and it can be found in WP-admin (WP dashboard) --> Event Espresso --> Events --> Templates. Then look for the Use Custom Display Order option and turn it on. Afterwards, you can drag and drop to adjust the Display Order. This can be done for the events listing page and the single event pages.

Event Espresso 4 uses a archive.php template file for the events listing page. Here is a sample URL for the events listing page:

example.com/events/

Event Espresso 4 uses a single.php template file for the single events page. Here is an example URL for a single events page:

example.com/events/my-fun-event/

Another popular use case for setting up new theme templates would be for changing the layout of the events listing page or the single events page to add or remove a sidebar. This can be done by creating a custom template file based on your current template (e.g. page.php or archive.php) and modifying as needed.

Here are the steps to setup the new theme templates for Event Espresso 4.

Step 1) Login to your WordPress root with your preferred SFTP or FTP client. Filezilla and Cyberduck are free options. On a Mac? Try Transmit

Step 2) Setup a child theme:

https://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme

This step will ensure that your customizations are not lost when you update your theme.

Step 3) Add the following filters to your child theme's functions.php file:

//* Allow the custom display order option to work with the archive-espresso_events.php theme template file
add_filter( 'FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', '__return_true' );

//* Allow the custom display order to work with the single-espresso_events.php theme template file
add_filter( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', '__return_true' );

Your child theme should be located in the WordPress themes folder. Here is an example:

/wp-content/themes/child-theme-folder

We are now ready to create the new theme templates for Event Espresso 4.

Step 4) Duplicate a archive.php theme template (or another theme template that you would like to use for the events listing page) and rename to archive-espresso_events.php.

Step 5) Duplicate a single.php theme template (or another theme template that you would like to use for the single event pages) and rename to single-espresso_events.php.

You can then go to your events listing page and a single event page to see your new templates in action.

Need more control of the layout and content of the various Event Espresso pages? A child theme for Twenty Fourteen is available here:

/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014

If you are wanting complete control of the content and layout of the Event Espresso pages, then you'll want to add custom templates to your child theme. The Espresso_Arabica_2014 child theme contains templates that could be used as an example for creating your own set of templates. If you try to use these templates as-is, then your Event Espresso pages (e.g events listing page and single event pages) may appear strange since the sample files are a child theme for the Twenty Fourteen theme.