<?php
/*
Template Name: 时间轴归档页
*/
?>
<?php get_header()?>
    <div id="layout">
        <div class="body_container">
            <div class="pure-g">
                <div class="pure-u-1-1">
                    <div id="archives">
                        <h1 class="archive_title">文章归档</h1>
                        <ul class="posts_in_year">
                            <?php
                            $previous_year = $year = 0;
                            $previous_month = $month = 0;
                            $ul_open = false;
                            $myposts = get_posts('numberposts=-1&orderby=post_date&order=DESC');
                            foreach($myposts as $post) :
                                setup_postdata($post);
                                $year = mysql2date('Y', $post->post_date);
                                if($year != $previous_year || $month != $previous_month) :
                                    if($ul_open == true) :
                                        echo '</ul>';
                                    endif;
                                    echo '<div class="year">'; echo the_time('Y'); echo '</div>';
                                    echo '<ul class="archives-monthlisting">';
                                    $ul_open = true;
                                endif;
                                $previous_year = $year; $previous_month = $month;
                                ?>
                                <li>
                                    <a href="<?php the_permalink(); ?>"  title="<?php the_title(); ?>" >
                                        <div style="background:#292929 url(<?php the4_thumb();?>) center;background-size:cover;" class="archive-post-cover"></div>
                                        <span class="date"><?php the_time('m/j'); ?></span>
                                        <span class="archive-post-title"><?php the_title(); ?></span>
                                    </a>

                                </li>
                            <?php endforeach; ?>
                        </ul>
                    </div>

                </div>
                <div class="pure-u-1-1">
                    <div class="paginator pager pagination no_pages" >
                        <div class="paginator_container pagination_container">
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
<?php get_footer()?>