Some code from a side project using the events build out from Noel Tock.
Event Shortcode <? /* ------------------- THEME FORCE ---------------------- */ /* * EVENTS SHORTCODES (CUSTOM POST TYPE) * http://www.noeltock.com/web-design/wordpress/how-to-custom-post-types-for-events-pt-2/ */ // 1) FULL EVENTS //*********************************************************************************** function tf_events_full ( $atts ) { // - define arguments - extract(shortcode_atts(array( 'limit' => '10', // # of events to show 'description' => '150' // # of Chars to show in description ), $atts)); // ===== OUTPUT FUNCTION ===== ob_start(); // ===== LOOP: FULL EVENTS SECTION ===== // - hide events that are older than 6am today (because some parties go past your bedtime) - $today6am = strtotime('today 6:00') + ( get_option( 'gmt_offset' ) * 3600 ); // - query - global $wpdb; $querystr = "SELECT * FROM $wpdb->posts wposts, $wpdb->postmeta metastart, $wpdb->postmeta metaend WHERE (wposts.ID = metastart.post_id AND wposts.ID = metaend.post_id) AND (metaend.meta_key = 'tf_events_enddate' AND metaend.meta_value > $today6am ) AND metastart.meta_key = 'tf_events_enddate' AND wposts.post_type = 'tf_events' AND wposts.post_status = 'publish' ORDER BY metastart.meta_value ASC LIMIT $limit"; $events = $wpdb->get_results($querystr, OBJECT); // - declare fresh day - $daycheck = null; // - loop - if ($events): global $post; foreach ($events as $post): setup_postdata($post); // - custom variables - $custom = get_post_custom(get_the_ID()); $sd = $custom["tf_events_startdate"][0]; $ed = $custom["tf_events_enddate"][0]; ?> <div class="full-events"> <?php // - determine if it's a new day - $longdate = date("l, F j, Y", $sd); if ($daycheck == null) { echo '<br /> <h3 class="title">' . $longdate . '</h3>'; } if ($daycheck != $longdate && $daycheck != null) { echo '<h3 class="title">' . $longdate . '</h3>'; } // - local time format - $time_format = get_option('time_format'); $stime = date($time_format, $sd); $etime = date($time_format, $ed); // - output - ?> <table> <tr> <td class="time"> </td> </tr> <tr> <td> </td> </tr> </table> </div>