请参阅:Paginate Codex
我可以看到您正在使用自定义查询,所以您将其放在while循环的下面和外部
<?php
global $wp_query;
$big = 999999999; // need an unlikely integer
$args = array(
\'base\' => str_replace( $big, \'%#%\', esc_url( get_pagenum_link( $big ) ) ),
\'format\' => \'?page=%#%\',
\'total\' => $wp_query->max_num_pages,
\'current\' => max( 1, get_query_var( \'paged\') ),
\'show_all\' => true,
\'end_size\' => 1,
\'mid_size\' => 2,
\'prev_next\' => False,
\'prev_text\' => __(\'« Previous\'),
\'next_text\' => __(\'Next »\'),
\'type\' => \'list\',
);
echo paginate_links($args);
?>