显示Add 1 Everytime查询


Add 1 Everytime query is shown

我有一个查询,它可以获得我博客上评分最高的5个内容。我如何才能做到这一点,以便将每个带有查询1的帖子添加到$number变量中?

基本上,我想要的是给评分最高的内容一个1-5之间的数字,第一个得到1,第二个得到2,第三个得到3,依此类推

<?php ( query_posts('category_name=music&showposts=3&orderby=comment_count&order=desc&post_status=future,publish') ) ; ?>

<?php while ( have_posts() ) : the_post(); ?>
<?php endwhile; ?>
<?php wp_reset_query(); ?> 

试试这个-只需将$number设置为0,然后使用++来增加数字,

<?php ( query_posts('category_name=music&showposts=3&orderby=comment_count&order=desc&post_status=future,publish') ) ; ?>

<?php $number=0; while ( have_posts() ) : the_post(); $number++; ?>
Rated #<?= $number ?>
<?php endwhile; ?>
<?php wp_reset_query(); ?>