Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created April 16, 2020 16:36
Show Gist options
  • Save joshfeck/9054b854b8d52576d0129bf2aff7e7c5 to your computer and use it in GitHub Desktop.
Save joshfeck/9054b854b8d52576d0129bf2aff7e7c5 to your computer and use it in GitHub Desktop.
Example of a custom template for the [ESPRESSO_EVENTS] shortcode. You can upload this to your WP child theme or into /wp-content/uploads/espresso/templates
<?php
/**
* This template will display a list of events - copy it to your theme folder
*
* @ package Event Espresso
* @ author Seth Shoultes
* @ copyright (c) 2008-2013 Event Espresso All Rights Reserved.
* @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing *
* @ link http://www.eventespresso.com
* @ version 4+
*/
/*************************** IMPORTANT *************************
* if you are creating a custom template based on this file,
* and do not wish to use the template display order controls in the admin,
* then change the following filter to:
* add_filter( 'FHEE__content_espresso_events__template_loaded', '__return_true' );
* comment out calls to the_content() and espresso_event_content_or_excerpt()
* then UN-comment and position the additional template parts
* that are loaded via the espresso_get_template_part() function to your liking
* and/or use any of the template tags functions found in:
* \wp-content\plugins\event-espresso-core\public\template_tags.php
************************** IMPORTANT **************************/
add_filter( 'FHEE__content_espresso_events__template_loaded', '__return_true' );
global $post;
$event_class = has_excerpt( $post->ID ) ? ' has-excerpt' : '';
$event_class = apply_filters( 'FHEE__content_espresso_events__event_class', $event_class );
?>
<?php do_action( 'AHEE_event_details_before_post', $post ); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( $event_class ); ?>>
<div id="espresso-event-list-header-dv-<?php echo $post->ID;?>" class="espresso-event-header-dv">
<?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?>
<?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?>
</div>
<div class="espresso-event-list-wrapper-dv">
<div class="event-content">
<?php echo $post->EE_Event->description_filtered(); ?>
</div>
<?php espresso_get_template_part( 'content', 'espresso_events-tickets' ); ?>
<?php espresso_get_template_part( 'content', 'espresso_events-datetimes' ); ?>
<?php espresso_get_template_part( 'content', 'espresso_events-venues' ); ?>
</div>
</article>
<!-- #post -->
<?php do_action( 'AHEE_event_details_after_post', $post );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment