我试图在WordPress上用分页方式显示每页10篇文章,第一页返回125篇文章,而不是10篇,其余页面按要求返回10篇文章,请协助:)
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$output = array();
global $post;
$args = array(\'nopaging\' => false, \'paged\' => $paged, \'posts_per_page\' => 10, \'post_type\' => \'post\', \'order\'=> \'DES\', \'orderby\' => \'date\');
$postslist = new WP_Query( $args );
if ( $postslist->have_posts() ) :
while ( $postslist->have_posts() ) : $postslist->the_post();
array_push($output, array("timestamp" => get_the_date(\'U\'),"img_url" => get_the_post_thumbnail_url(), "title" => get_the_title(), "text" => get_the_content()));
endwhile;
wp_reset_postdata();
endif;