【发布时间】:2015-11-12 22:57:48
【问题描述】:
我有以下问题:我需要创建非常简单的布局,在每一行我希望有 3 个大小相同的盒子,如果我理解正确,为了实现这一点,我需要构建一个结构像下面这样:
<div class="row">
<div class=" news col-md-3 col-centered">
</div>
<div class=" news col-md-3 col-centered">
</div>
<div class=" news col-md-3 col-centered">
</div>
</div>
这是我在 index.php 中的 php 脚本:
<?php while(have_posts()) : the_post();?>
<div class="row">
<div class=" news col-md-3 col-centered">
<h4><a href="<?php the_permalink();?>"><?php the_title();?></a></h4>
<p><?php the_excerpt(); ?> </p>
</div>
</div>
<?php endwhile; wp_reset_query(); ?>
使用此代码,每个框都会获得一个<div class="row"> 元素,如下所示:
<div class="row">
<div class=" news col-md-3 col-centered">
</div>
</div>
...
我该如何解决这个问题?
【问题讨论】:
标签: php html wordpress twitter-bootstrap