This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Past Events

By: inTOWN on Nov 15th, 2011  |  syntax: None  |  size: 1.92 KB  |  views: 60  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.  
  12. $event = array();
  13. $tribe_ecp = TribeEvents::instance();
  14. reset($tribe_ecp->metaTags); // Move pointer to beginning of array.
  15. foreach($tribe_ecp->metaTags as $tag){
  16.         $var_name = str_replace('_Event','',$tag);
  17.         $event[$var_name] = tribe_get_event_meta( $post->ID, $tag, true );
  18. }
  19.  
  20. $event = (object) $event; //Easier to work with.
  21.  
  22. ob_start();
  23.         post_class($alt_text,$post->ID);
  24. $class = ob_get_contents();
  25. ob_end_clean();
  26.  
  27. ?>
  28. <div class="upcoming">
  29.  
  30. <hgroup><div class="icon"><div class="news"></div></div> <h3>Past Events</h3></hgroup>
  31.  
  32. <?php $loop = new WP_Query( array( 'post_type' => 'tribe_events', 'posts_per_page' => 2, 'orderby' => 'date', 'order' => 'ASC', 'paged', 'eventDisplay' => 'past') ); ?>
  33.   <ul id="list" class="small">
  34.  
  35.   <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
  36.     <?php tribe_is_past($post->ID, 'tribe_is_past', true); ?>
  37.         <li class="small">
  38.    
  39.         <a href="<?php the_permalink(); ?>"><?php if ( has_post_thumbnail() ) the_post_thumbnail('small-list-thumbnail'); ?></a>
  40.         <span>
  41.         <h4><?php the_title('<a href="' . tribe_get_event_link() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a>'); ?> </h4>
  42.         <?php echo tribe_get_start_date( null, false, 'd.m.y' ); ?> <br />
  43.         <?php  $venue = tribe_get_venue();  if ( !empty( $venue ) ) : ?><?php echo $venue; ?> <?php endif; ?>
  44.         <?php  $country = tribe_get_country();  if ( !empty( $country ) ) : ?><?php echo $country; ?> <?php endif; ?>
  45.  
  46.         </span>
  47.      </li>
  48. <?php endwhile; ?>
  49. </ul>
  50.    
  51.  
  52. </div>
  53.  
clone this paste RAW Paste Data