/**
* Display pagination information in the format "X - Y of Z".
*
* @param object $wp_query Optionally generate string from custom query, defaults to main.
*/
function wpse_106121_posts_count( $wp_query = null ) {
if ( ! $wp_query )
global $wp_query;
$posts = min( ( int ) $wp_query->get( \'posts_per_page\' ), $wp_query->found_posts );
$paged = max( ( int ) $wp_query->get( \'paged\' ), 1 );
$count = ( $paged - 1 ) * $posts;
printf(
\'%d - %d of %d\',
$count + 1,
$count + $wp_query->post_count,
$wp_query->found_posts
);
}
将上述内容放入
functions.php
, 然后在要显示文本的位置调用它:
<?php wpse_106121_posts_count() ?>