php 将帖子计数类添加到WordPress循环

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 将帖子计数类添加到WordPress循环相关的知识,希望对你有一定的参考价值。

<?php
  // Count the posts and give them each a unqiue number as a css class
  $count = 1; 
  while ( $query->have_posts() ) : $query->the_post(); $count <= 100; ?>
      <div class="count-<?php echo $count++; ?>">
          <p class="headline"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
      </div>
    <?php endwhile; ?>

以上是关于php 将帖子计数类添加到WordPress循环的主要内容,如果未能解决你的问题,请参考以下文章