Created
June 17, 2011 02:43
-
-
Save anonymous/1030760 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$today = date("o-m-d"); | |
$future = strtotime ( '+6 days' , strtotime ( $today ) ) ; | |
$future = date ( 'o-m-d' , $future ); | |
$event_query = new WP_Query( | |
array( | |
'post_type' => 'event', | |
'meta_key' => 'event-date', | |
'orderby' => 'meta_value', | |
'order' => 'asc', | |
'meta_query' => array( | |
array( | |
'key' => 'event-date', | |
'value' => array($today,$future), | |
'compare' => 'BETWEEN', | |
'type' => 'DATE' | |
) | |
) | |
) | |
); | |
?> | |
<?php for ($i=0; $i<7; $i++): | |
$thedate = strtotime ( '+'.$i.' day' , strtotime ( $today ) ) ; | |
$thedate = date ( 'o-m-d' , $thedate ); | |
$events_today = false; ?> | |
<div class="event_item <?php if($i == 0) echo "first_event"; ?> <?php if($i == 6) echo "last_event"; ?>"> | |
<div class="event_item_day"> | |
<span class="day_of_week"><?php if($i == 0) { ?> Today <?php } else {?> | |
<?php echo date("l", strtotime($thedate)); } ?></span> | |
<br /><?php echo date( "n/j/y", strtotime($thedate));?> | |
</div> | |
<!-- FEATURED EVENTS BY DAY --> | |
<?php if ($event_query->have_posts()) : while ($event_query->have_posts()) : $event_query->the_post();?> | |
<?php | |
$the_event_date = get_post_meta($post->ID, 'event-date', true); | |
$the_event_featured = get_post_meta($post->ID, 'featured', true); | |
if($the_event_date == $thedate && $the_event_featured == '1') : $events_today = true;?> | |
<div class="event_thumb"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('event_thumb'); ?></a></div> | |
<div class="event_info"> | |
<span class="event_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></span> | |
<span class="event_category"><?php echo get_the_term_list( get_the_ID(), 'event_category', " " ) ?></span> | |
<span class="event_location"><?php meta('event-location'); ?></span><br /> | |
<?php if($i == 0) echo get_post_meta($post->ID, 'short', true);?> | |
</div> | |
<div class="more_events"><a href="#" class="<?php echo $thedate ?>" >More Events</a></div> | |
<script>$(document).ready(function(){ | |
$(".<?php echo $thedate ?>").colorbox({width:"50%", inline:true, href:"#<?php echo $thedate ?>"}); | |
});</script> | |
<?php endif; ?> | |
<?php endwhile; endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment