Hi,
I have this code for an events listing, and I was wondering if there's a way to re-work some of it so that its organized by month with a monthly header.
So for example:
February
- event
- event
January
- event
- event
Thanks!
<?php
$upevent = array(
'post_type' => 'events',
'meta_key' => 'tf_events_startdate',
'orderby' => 'meta_value',
'order' => 'DESC',
'posts_per_page' => -1
);?>
<ul>
<?php query_posts($upevent); ?>
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<?php
$custom = get_post_custom(get_the_ID());
// dates
$sd = $custom["tf_events_startdate"][0];
$ed = $custom["tf_events_enddate"][0];
// - local time format -
$time_format = get_option('time_format');
$stime = date($time_format, $sd);
$etime = date($time_format, $ed);
?>
<?php // - determine if it's a new day -
$longdate = date("l, M j, Y", $sd);
if ($daycheck == null) { echo $longdate; }
if ($daycheck != $longdate && $daycheck != null) { echo $longdate; } ?>
<br />
<?php echo $stime;?>
<br />
<strong><a href="<?php the_permalink();?>"><?php the_title();?></a></strong>
<hr />
<?php endwhile; else: ?>
<p><strong><?php include('inc/nope.php');?></strong></p>
<?php endif; ?>
<?php wp_reset_query(); ?>