WordPress.org

Support

Support » Plugins and Hacks » [Plugin: The Events Calendar] Past events

[Plugin: The Events Calendar] Past events

Viewing 8 replies - 1 through 8 (of 8 total)
  • Ah, foundit:

    <?php $loop = new WP_Query( array( 'post_type' => 'tribe_events', 'posts_per_page' => 2, 'orderby' => 'date', 'order' => 'ASC', 'paged', 'eventDisplay' => 'past') ); ?>

    berchman
    Participant

    @berchman

    What if you wanted to display past events in an unordered list?

    berchman
    Participant

    @berchman

    I did try this with no luck

    <ul id="past_events">
    <?php $args = array( 'post_type' => 'tribe_events', 'posts_per_page' => 5, 'eventDisplay' => 'past' );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; ?>
    </ul>

    Check this:

    berchman
    Participant

    @berchman

    Mea Culpa.

    The code I posted does indeed work.
    You just need to make sure you have a past event entered 😛

    I see my link to pastebin didn’t work… let’s try again:

    uh??? Okay try like this:

    <?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'); }
    
    $event = array();
    $tribe_ecp = TribeEvents::instance();
    reset($tribe_ecp->metaTags); // Move pointer to beginning of array.
    foreach($tribe_ecp->metaTags as $tag){
    	$var_name = str_replace('_Event','',$tag);
    	$event[$var_name] = tribe_get_event_meta( $post->ID, $tag, true );
    }
    
    $event = (object) $event; //Easier to work with.
    
    ob_start();
    	post_class($alt_text,$post->ID);
    $class = ob_get_contents();
    ob_end_clean();
    
    ?>
    <div class="upcoming">
    
    <hgroup><div class="icon"><div class="news"></div></div> <h3>Past Events</h3></hgroup>
    
    <?php $loop = new WP_Query( array( 'post_type' => 'tribe_events', 'posts_per_page' => 2, 'orderby' => 'date', 'order' => 'ASC', 'paged', 'eventDisplay' => 'past') ); ?>
      <ul id="list" class="small">
    
      <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
        <?php tribe_is_past($post->ID, 'tribe_is_past', true); ?>
      	<li class="small">
    
        	<a href="<?php the_permalink(); ?>"><?php if ( has_post_thumbnail() ) the_post_thumbnail('small-list-thumbnail'); ?></a>
            <span>
            <h4><?php the_title('<a href="' . tribe_get_event_link() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a>'); ?> </h4>
            <?php echo tribe_get_start_date( null, false, 'd.m.y' ); ?> <br />
            <?php  $venue = tribe_get_venue();  if ( !empty( $venue ) ) : ?><?php echo $venue; ?> <?php endif; ?>
            <?php  $country = tribe_get_country();  if ( !empty( $country ) ) : ?><?php echo $country; ?> <?php endif; ?>
    
            </span>
         </li>
    <?php endwhile; ?>
    </ul>
    
    </div>

    bwp
    Member

    @bwordpress

    Great, inTOWN. First they kill posts with too much code and tell us to use a pastebin, and then they block pastebin links?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: The Events Calendar] Past events’ is closed to new replies.