Created
August 16, 2017 22:52
-
-
Save jentheo/c8092b33a1b4bac6383dca713ce07142 to your computer and use it in GitHub Desktop.
Exclude recurring events from list view after first event has started
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 | |
/** | |
* List View Loop | |
* This file sets up the structure for the list loop | |
* | |
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/list/loop.php | |
* | |
* @version 4.4 | |
* @package TribeEventsCalendar | |
* | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
die( '-1' ); | |
} ?> | |
<?php | |
global $post; | |
global $more; | |
$more = false; | |
?> | |
<div class="tribe-events-loop"> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<?php | |
// Exclude recurring events if series has already started | |
if ( tribe_is_recurring_event( $event_id ) ) { | |
$parent_id = wp_get_post_parent_id( $event_id ); | |
$over = ( tribe_is_past_event( $parent_id ) ) ? true : false; | |
if ( $over ) { | |
continue; | |
} | |
} | |
?> | |
<?php do_action( 'tribe_events_inside_before_loop' ); ?> | |
<!-- Month / Year Headers --> | |
<?php tribe_events_list_the_date_headers(); ?> | |
<!-- Event --> | |
<?php | |
$post_parent = ''; | |
if ( $post->post_parent ) { | |
$post_parent = ' data-parent-post-id="' . absint( $post->post_parent ) . '"'; | |
} | |
?> | |
<div id="post-<?php the_ID() ?>" class="<?php tribe_events_event_classes() ?>" <?php echo $post_parent; ?>> | |
<?php | |
$event_type = tribe( 'tec.featured_events' )->is_featured( $post->ID ) ? 'featured' : 'event'; | |
/** | |
* Filters the event type used when selecting a template to render | |
* | |
* @param $event_type | |
*/ | |
$event_type = apply_filters( 'tribe_events_list_view_event_type', $event_type ); | |
tribe_get_template_part( 'list/single', $event_type ); | |
?> | |
</div> | |
<?php do_action( 'tribe_events_inside_after_loop' ); ?> | |
<?php endwhile; ?> | |
</div><!-- .tribe-events-loop --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment