Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * The TEC template for a list of events. This includes the Past Events and Upcoming Events views
- * as well as those same views filtered to a specific category.
- *
- * You can customize this view by putting a replacement file of the same name (list.php) in the events/ directory of your theme.
- */
- // Don't load directly
- if ( !defined('ABSPATH') ) { die('-1'); }
- $load_register = false;
- ?>
- <div id="tribe-events-content" class="upcoming">
- <div id="tribe-events-loop" class="tribe-events-events post-list clearfix">
- <?php
- $url_args = explode('/',$_SERVER['SCRIPT_URL']);
- switch($url_args[2]){
- case 'upcoming':
- $args = array(
- 'post_type' => 'tribe_events',
- 'order_by' => 'meta_value_num',
- 'meta_key' => '_EventStartDate',
- 'order' => 'ASC',
- 'meta_query' => array(
- 'key' => '_EventStartDate',
- 'value' => date('Y-m-d h:i:s',strtotime("-1 day")),
- 'compare' => '>'
- )
- );
- $page_title = 'Upcoming Events';
- break;
- default:
- $args = array(
- 'post_type' => 'tribe_events',
- 'order_by' => 'title',
- 'order' => 'ASC'
- );
- $page_title = 'All Events';
- }
- var_dump($args);
- echo '<h2 class="story_title">' . $page_title . '</h2>';
- // Reset Post Data
- wp_reset_query();
- wp_reset_postdata();
- $the_query = new WP_Query( $args );
- var_dump($the_query);
- // The Loop
- while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
- <div class="tribe_event_teaser">
- <div class="te_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
- <div class="te_date"><?php echo tribe_get_start_date( null, false, 'D, F jS, Y' ); ?></div>
- <div class="te_venue">
- <?php
- if( tribe_address_exists( get_the_ID() ) ){
- echo tribe_get_city( get_the_ID() ) . ', ' . tribe_get_state( get_the_ID() );
- }
- ?>
- </div>
- <div class="clearfix"></div>
- </div>
- <?php endwhile;
- // Reset Post Data
- wp_reset_postdata();
- ?>
- </div><!-- #tribe-events-loop -->
- </div>
Advertisement
Add Comment
Please, Sign In to add comment