2013-03-21 69 views
0

早上好,我發現自己處於一種兩難的境地!我創建使用Twitter的引導WordPress的主題,我生成成員通過WordPress的「帖子」的「拜見團隊」頁面,我只能適應1排3項... IE自動生成Word中的Twitter Bootstrap行

<div class="row"> 
    <div class="span4"></div> 
    <div class="span4"></div> 
    <div class="span4"></div> 
</div> 

不過了每行的3個條目會打破該行,所以我需要爲每3個條目生成一個新行。我怎樣才能做到這一點?

這是我輸出條目的PHP代碼。

<?php query_posts('category_name=members&orderby=date'); ?> 
<div class="row-fluid"> 
    <ul class="thumbnails"> 
     <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
     <li class="span4"> 
      <div class="thumbnail"> 
      <?php // check if the post has a Post Thumbnail assigned to it.the_post_thumbnail(); 
      ?> 
       <div class="pad"> 
       <h3><?php the_title(); ?></h3> 
       <?php the_content(); ?> 
       </div> 
      </div> 
     </li> 
    <?php endwhile; ?> 
    </ul> 
    </div> 
<?php endif; ?> 

回答

0

試試這個

<?php query_posts('category_name=members&orderby=date'); ?> 
<div class="row-fluid"> 
    <ul class="thumbnails"> 
     <?php 
     $cnt =0; 
     if (have_posts()) : while (have_posts()) : the_post(); 
     if($cnt%3==0){ 
      echo "</ul></div><div class='row-fluid'><ul clsas='thumbnails'>"; 
     } 

     ?> 
     <li class="span4"> 
      <div class="thumbnail"> 
      <?php // check if the post has a Post Thumbnail assigned to it.the_post_thumbnail(); 
      ?> 
       <div class="pad"> 
       <h3><?php the_title(); ?></h3> 
       <?php the_content(); ?> 
       </div> 
      </div> 
     </li> 
    <?php 
    $cnt++; 
    endwhile; ?> 
    </ul> 
    </div> 
<?php endif; ?>