Guest User

list.php

a guest
Jan 13th, 2012
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.05 KB | None | 0 0
  1. <?php
  2. /**
  3. * The TEC template for a list of events. This includes the Past Events and Upcoming Events views
  4. * as well as those same views filtered to a specific category.
  5. *
  6. * You can customize this view by putting a replacement file of the same name (list.php) in the events/ directory of your theme.
  7. */
  8.  
  9. // Don't load directly
  10. if ( !defined('ABSPATH') ) { die('-1'); }
  11. $load_register = false;
  12. ?>
  13. <div id="tribe-events-content" class="upcoming">
  14.  
  15.     <div id="tribe-events-loop" class="tribe-events-events post-list clearfix">
  16.    
  17.     <?php
  18.         $url_args = explode('/',$_SERVER['SCRIPT_URL']);
  19.         switch($url_args[2]){
  20.             case 'upcoming':
  21.                 $args = array(
  22.                     'post_type' => 'tribe_events',
  23.                     'order_by' => 'meta_value_num',
  24.                     'meta_key' => '_EventStartDate',
  25.                     'order' => 'ASC',
  26.                     'meta_query' => array(
  27.                         'key' => '_EventStartDate',
  28.                         'value' => date('Y-m-d h:i:s',strtotime("-1 day")),
  29.                         'compare' => '>'
  30.                     )
  31.                 );
  32.                 $page_title = 'Upcoming Events';
  33.             break;
  34.             default:   
  35.                 $args = array(
  36.                     'post_type' => 'tribe_events',
  37.                     'order_by' => 'title',
  38.                     'order' => 'ASC'
  39.                 );
  40.                 $page_title = 'All Events';
  41.         }
  42.    
  43.         var_dump($args);
  44.         echo '<h2 class="story_title">' . $page_title . '</h2>';
  45.    
  46.         // Reset Post Data
  47.         wp_reset_query();
  48.         wp_reset_postdata();
  49.    
  50.         $the_query = new WP_Query( $args );
  51.        
  52.         var_dump($the_query);
  53.        
  54.  
  55.         // The Loop
  56.         while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
  57.    
  58.             <div class="tribe_event_teaser">
  59.                 <div class="te_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
  60.                 <div class="te_date"><?php echo tribe_get_start_date( null, false, 'D, F jS, Y' ); ?></div>
  61.                 <div class="te_venue">
  62.                 <?php
  63.                     if( tribe_address_exists( get_the_ID() ) ){
  64.                         echo tribe_get_city( get_the_ID() ) . ', ' . tribe_get_state( get_the_ID() );
  65.                     }
  66.                 ?>
  67.                 </div>
  68.                 <div class="clearfix"></div>
  69.             </div>
  70.         <?php endwhile;
  71.  
  72.         // Reset Post Data
  73.         wp_reset_postdata();
  74.    
  75.     ?>
  76.  
  77.  
  78.     </div><!-- #tribe-events-loop -->
  79. </div>
Advertisement
Add Comment
Please, Sign In to add comment