首先,请不要使用query_posts
, 但是new WP_Query
.
基于页面的输出计数只是使用当前页码和每页的帖子数进行简单算术运算的问题。
global $wp_query;
$paged = $wp_query->get(\'paged\') ? : 1;
$posts_per_page = 10; // feel free to change this
$args = array(
\'cat\' => 47,
\'meta_key\' => \'cb_vote_nb_vote\',
\'orderby\' => \'meta_value\',
\'order\' => \'DESC\',
\'paged\' => $paged,
\'posts_per_page\' => $posts_per_page
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
$current_order = ( $query->current_post + 1 ) + ( $posts_per_page * ( $paged - 1) );
echo \'Current post order is :\' . $current_order;
endwhile; endif;
wp_reset_postdata();