Last active
August 29, 2015 14:07
-
-
Save joshfeck/6e7c2ad6b80387f442d7 to your computer and use it in GitHub Desktop.
Event Espresso 4 event content template part that will display only events that have tickets available on the event list page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This template will display a single event - 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+ | |
*/ | |
global $post; | |
$event_class = has_excerpt( $post->ID ) ? ' has-excerpt' : ''; | |
$event_class = apply_filters( 'FHEE__content_espresso_events__event_class', $event_class ); | |
// check to see if any tickets are still available for sale | |
$tickets_are_available = espresso_event_tickets_available( $post->ID, FALSE, FALSE ); | |
$show_event = is_array( $tickets_are_available ) ? TRUE : FALSE; | |
?> | |
<?php do_action( 'AHEE_event_details_before_post', $post ); ?> | |
<?php if ( is_single() ) : ?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class( $event_class ); ?>> | |
<div id="espresso-event-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-wrapper-dv"> | |
<?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-details' ); ?> | |
<?php espresso_get_template_part( 'content', 'espresso_events-venues' ); ?> | |
<footer class="event-meta"> | |
<?php do_action( 'AHEE_event_details_footer_top', $post ); ?> | |
<?php do_action( 'AHEE_event_details_footer_bottom', $post ); ?> | |
</footer> | |
</div> | |
</article> | |
<!-- #post --> | |
<?php // check to see if it's an event list and if tickets are available | |
elseif ( is_archive() && $show_event ) : ?> | |
<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"> | |
<?php espresso_get_template_part( 'content', 'espresso_events-datetimes' ); ?> | |
<?php espresso_get_template_part( 'content', 'espresso_events-details' ); ?> | |
<?php espresso_get_template_part( 'content', 'espresso_events-venues' ); ?> | |
<?php espresso_get_template_part( 'content', 'espresso_events-tickets' ); ?> | |
</div> | |
</article> | |
<!-- #post --> | |
<?php endif; ?> | |
<?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