Example #1
0
 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;
 }
Example #2
0
<article class="f-<?php 
echo esc_attr($this_post_format);
?>
">
	<?php 
get_template_part('once', $this_post_format);
// Anything that happens once per grouping of posts
get_template_part('snippet', $this_post_format);
// On the homepage, we do some lookahead magic and collapse posts a bit
// Don't collapse images, they deserve full display, always
// Break for each new day also
if (Homeroom::get_option('collapse_consecutive_posts') && is_home() && 'image' != $this_post_format && '' != $this_post_format) {
    $temp_post = $post;
    $first = true;
    while (true) {
        $next = homeroom_next_post();
        // Different post format, or nothing else to output?
        if (!$next || $this_post_format != get_post_format($next)) {
            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;