如何选择每1st 2nd 3rd .... nth

时间:2019-03-28 20:06:30

标签: php arrays wordpress if-statement foreach

我只是想在wordpress循环中执行此操作,并且希望获得轻松的结果。

<?php 
if ( have_posts() ) {
    while ( have_posts() ) {
        the_post(); 
        //
        // Post Content here
        //
    } // end while
} // end if
?>

<div class="List-Module">
  <div class="List-Module-Big">TITLE OF POST#1</div>
  <div class="List-Module-Grid">
    <div class="List-Module-Grid-Item">TITLE OF POST#2</div>
    <div class="List-Module-Grid-Item">TITLE OF POST#3</div>
  </div>
  <div class="List-Module-Item">TITLE OF POST#4</div>
  <div class="List-Module-Big">TITLE OF POST#5</div>
  <div class="List-Module-Grid">
    <div class="List-Module-Grid-Item">TITLE OF POST#6</div>
    <div class="List-Module-Grid-Item">TITLE OF POST#7</div>
  </div>
  <div class="List-Module-Item">TITLE OF POST#8</div>
</div>

//loops all through 32 items

如您所见1n,2n,3n和4n帖子的结果必须位于不同的类中。你能帮忙吗?

0 个答案:

没有答案