WordPress分页返回页面链接不正确的永久链接?

时间:2017-11-16 11:10:08

标签: wordpress pagination

我有一个wp查询循环,我已经添加了pagination_links函数来返回我的分页。我有一个问题,第一页的链接是否返回当前页面而不是第一页的链接?

有谁能看到下面的问题?

$posts_per_page = get_option('posts_per_page');
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;

$args = array(
    'posts_per_page' => $posts_per_page,
    'post_type' => 'post',
    'paged' => $paged,
);

$articles = new WP_Query( $args ); 

args = array(
    'base'               => '%_%',
    'format'             => '?paged=%#%',
    'current'            => max( 1, get_query_var('paged') ),
    'total'              => $articles->max_num_pages,
    'show_all'           => false,
    'end_size'           => 1,
    'mid_size'           => 1,
    'prev_next'          => true,
    'prev_text'          => __('Previous'),
    'next_text'          => __('Next'),
    'type'               => 'plain',
    'add_args'           => false,
    'add_fragment'       => '',
    'before_page_number' => '',
    'after_page_number'  => ''
);

echo paginate_links( $args );

0 个答案:

没有答案