Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php $the_query = new WP_Query( array( 'meta_key' => 'event_venue', 'meta_value' => $mix_venue ) ); // Query database where $event_value matches $mix_value of current post ?>
- <?php
- // The Loop for displaying upcoming events...
- if ($the_query->have_posts()){ // Check if the query has post to display, if it does, then.....
- while ( $the_query->have_posts() ) :
- $the_query->the_post();
- $event_date = get_post_meta(get_the_ID(), 'event_date', true);
- // Convert input date to UNIX timestamp for use with Upcoming vs Past events
- if (!empty($event_date)){ // Check if event_date has been set through admin panel
- $event_day = substr($event_date, 1,2 );
- $event_month = substr($event_date, 4,5);
- $event_year = substr($event_date, 6,10);
- $timestamp = mktime(0,0,0,$event_day,$event_month,$event_year);
- $formateddate = date("l, F jS Y" ,$timestamp);
- $event_status = '';
- if (strtotime($formateddate) < time() ) {
- $event_status = 'Past Event';
- }
- else
- $event_status = 'Upcoming';
- }
- else
- $event_status = '';
- if ($event_status == 'Upcoming'){ // Check $event_status so we only show upcoming events, rather than past events, for now...?>
- <div class="inner-title"><h2 class="entry-title">Upcoming events @ <?php echo $mix_venue ?></h2></div>
- <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="20%" align="left" valign="top"><?php // check if the post has a Post Thumbnail assigned to it.
- if ( has_post_thumbnail() ) { the_post_thumbnail( array(100,100) ); } ?></td>
- <td width="83%"><h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
- <div class="entry-meta">
- <?php include 'event_info.php' // Get and display event info such as venue, dresscode, time, etc ?>
- </div><!-- .entry-meta -->
- <div class="summary">
- <?php the_excerpt(); ?>
- </div><!-- .entry-summary -->
- </td>
- </tr>
- </table>
- </div><!-- #post-## -->
- <?php } else echo '';
- endwhile; // Ends loop displaying upcoming events
- // Restore original Query & Post Data
- wp_reset_query();
- wp_reset_postdata();
- } else {
- global $up_events; // initialise global variable $up_events
- $up_events = 'none'; // if $the_query has no posts to display, set $up_events to 'none'
- }
- if($up_events =='none'){ // Only if $up_events is set to 'none', display related photos
- include 'related_photos.php'; // Displays photos related to this venue
- } else echo ''; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement