wordpress 文章怎样循环数字123
时间:4年前 阅读:1886
<?php if (have_posts()) : ?>
<?php $i=1; while (have_posts()) : the_post(); ?>
<li>
<span class="num"><?php echo $i;$i++; ?></span><?php the_title();//标题 ?>
</li>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
说明:如果$i=0表示从0开始循环,如果$i=1表示从1开始循环,从几都可以,有多少条li就会自动循环到几。
网友评论