function get_timeslot($id, $fancy = false) { $output = ''; $custom_fields = get_post_custom($id); $dayInt = $custom_fields['start_day'][0]; $startHour = $custom_fields['start_hour'][0]; $endHour = $custom_fields['end_hour'][0]; if ($endHour === '0') { $endHour = 24; } if (strlen($dayInt)) { $output .= display_day_of_week($dayInt, $fancy) . ' '; $output .= $startHour . ':00'; $output .= ' - '; $output .= $endHour . ':00'; } return $output; }
if (have_posts()) { while (have_posts()) { the_post(); $id = get_the_ID(); $custom_fields = get_post_custom(); $day = $custom_fields['start_day'][0]; if ($day !== $loop_day) { if ($loop_day !== '') { echo '</ul></section>'; } $loop_day = $day; ?> <section class="schedule-block"> <div class="day"> <?php echo display_day_of_week($day, true); ?> </div> <ul class="schedule"> <?php } ?> <li> <a href="<?php the_permalink(); ?> "> <?php echo $custom_fields['start_hour'][0]; ?>