I saw a request for a simple 7 day event calendar that always starts with today.
I have a custom meta box called opening-time that gets a YYYY-MM-DD input.
For now this is what I have, and its not working.
It only outputs 2011-11-17 today is 11-11-2011 so that is wrong. It also must have a php error because none of the blog outputs either.
Thank you in advance.
<ul id="days_header">
<?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' => 'opening_time',
'orderby' => 'meta_value',
'order' => 'asc',
'meta_query' => array(
array(
'key' => 'opening_time',
'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 ); ?>
<li>
<?php echo $thedate; ?>
<?php if ($event_query->have_posts()) : while ($event_query->have_posts()) : $event_query->the_post();?>
<?php if(meta('opening_time') == $thedate) :?>
<?php the_title(); ?>
<?php else: ?>
No Events Today
<?php endif; ?>
</li>
<?php endwhile; endif; rewind_posts(); ?>