function collate_checkins() { // Don't want random maps appearing amongst our archives if (!is_front_page() && !is_post_type_archive('status')) { return; } // Foursquare check-ins just aren't that useful, so we're only going to show them on // a single map, at MOST once per 24 hours. // First, get the datestamp from the post that was just rendered $previous = get_the_date('Y-m-d H:i:s', '', '', false); if (!$this->multimap_start) { $this->multimap_start = $previous; } // Then check for the next post $next = homeroom_next_post(); if (!$next) { // If we hit the end of the page, output another map unless the last thing we did was a map if (!$this->just_did_map) { if (!$this->multimap_end) { $this->multimap_end = $previous; } $this->render_multipoint_map(); $this->multimap_start = $this->multimap_end = false; } return; } homeroom_prev_post(); $next = $next->post_date; // Already in Y-m-d H:i:s $next = explode(' ', $next); $previous = explode(' ', $previous); // Same day still? Bail. if ($previous[0] == $next[0]) { return; } if (substr($this->last_map, 0, strpos($this->last_map, ' ')) == $previous[0]) { return; } // todo: add in logic to get us to 5am/handle gaps etc $this->multimap_end = $next[0] . ' ' . $next[1]; $this->render_multipoint_map(); $this->multimap_start = $this->multimap_end = false; }
break; } // Different day? @todo, - decide on time/hour to split? if (get_the_date('Y-m-d') != substr($next->post_date, 0, strpos($next->post_date, ' '))) { break; } // Looks good -- set up the post and then output this snippet $post = $next; setup_postdata($post); // If this was the first post output for this format, include a collapsible wrapper if ($first) { echo '<div class="collapse" data-date="' . esc_attr(get_the_date()) . '">'; $first = false; } get_template_part('snippet', $this_post_format); } if ($next) { // If there was a $next, but it wasn't an Aside if (!$first) { echo '</div>'; // collapse wrapper } homeroom_prev_post(); // dial it back a notch $post = $temp_post; } } ?> </article> <?php do_action('after_post');