Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Modern Tribe ECP Filter
- function tribe_filtered_cat_display() {
- global $post;
- //Setup Variables
- $slug = get_post( $post )->post_name; // I'll need the current page's slug in my query
- $cat_events = new WP_Query();
- $cat_events->query(array(
- 'post_type'=> 'tribe_events',
- 'eventDisplay'=>'upcoming',
- 'posts_per_page'=>3,
- 'tax_query'=> array(
- array(
- 'taxonomy' => 'tribe_events_cat',
- 'field' => 'slug',
- 'terms' => $slug
- )
- )
- )
- );
- if ($cat_events->have_posts()) :
- while ($cat_events->have_posts()) :
- $cat_events->the_post();
- $sttime = tribe_get_start_date($post, false, $format= 'h:i A');
- $endtime = tribe_get_end_date($post, false, $format= 'h:i A');
- ?>
- <div class="date">
- <?php echo tribe_get_start_date($post, false, $format = 'M' ); ?>
- <?php echo tribe_get_start_date($post, false, $format = 'd' ); ?>
- </div>
- <div class="details">
- <h6 class="title"><a href="<?php echo tribe_get_event_link() ?>" rel="bookmark"><?php the_title(); ?></a></h6>
- <?php if ( $cost && tribe_get_cost() ) { ?>
- <span class="cost"><?php echo tribe_get_cost( null, true ); ?></span>
- <div class="divider ">|</div>
- <?php } ?>
- <?php if(tribe_event_is_all_day() == false) {echo $sttime . ' – ' . $endtime . '<br />';} else {echo $sttime . '<br />';}; ?>
- <span class="venue"><?php echo tribe_get_venue_link(); ?></span>
- </div><hr />
- <?php endwhile;
- else :
- echo 'There are no events to display.';
- endif;
- wp_reset_query(); // Don't forget to reset the query.
- }
Advertisement
Add Comment
Please, Sign In to add comment