Php Wordpress:逐月发布帖子,发布布局

Php Wordpress:逐月发布帖子,发布布局,php,html,css,wordpress,archive,Php,Html,Css,Wordpress,Archive,我每月都会收到wordpress的帖子,但我遗漏了一些明显的东西,因为它会稍微影响我的布局。我正在使用996网格系统进行布局 需求: 我在2013年3月收到了所有的帖子,我想把它们分别放在一张纸上,这样3篇帖子就像截图a一样堆叠起来 我的代码如下: <div class="container clearfix" style="background:yellow;"> <div class="grid_12" style="background:blue;">

我每月都会收到wordpress的帖子,但我遗漏了一些明显的东西,因为它会稍微影响我的布局。我正在使用996网格系统进行布局

需求:

我在2013年3月收到了所有的帖子,我想把它们分别放在一张纸上,这样3篇帖子就像截图a一样堆叠起来

我的代码如下:

<div class="container clearfix" style="background:yellow;">
    <div class="grid_12" style="background:blue;">
        <?php
                $blogtime = date('Y');
                $prev_limit_year = $blogtime - 1;
                $prev_month = '';
                $prev_year = '';
                $args = array(
                    'posts_per_page' => 20,
                    'ignore_sticky_posts' => 1
                );
                $postsbymonth = new WP_Query($args);

                while($postsbymonth->have_posts()) {
                    $postsbymonth->the_post();
                    if(get_the_time('F') != $prev_month || get_the_time('Y') != $prev_year && get_the_time('Y') == $prev_limit_year) {

                        echo "<h2>".get_the_time('F, Y')."</h2>\n\n";

                        }
            ?>
    </div>

<div class="grid_4" style="background:red;">
    <article id="post-<?php the_ID(); ?>" role="article" itemscope itemtype="http://schema.org/BlogPosting">
        <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('standard-thumb'); ?></a>
        <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    </article>
</div>

<?php
$prev_month = get_the_time('F');
$prev_year = get_the_time('Y');
}
    ?>
</div> <!-- END OF CONTAINER -->

问题:

使用上述代码,grid_4的每个实例都位于容器外部,第一个实例除外。见截图B

如何确保容器中包含所有网格分区


我试着移动了这个div,但它没有起作用,我想我在查询中遗漏了一些基本的东西

因此,如果我删除网格4的结束div,它现在可以工作了

在dom中,它现在都位于容器中。。。然而,看看模板标记代码,我是一个div短

我不知道为什么会这样,但它是。。。总有一天我会明白为什么,但现在wordpress自动添加了一个额外的div