分页链接功能:页面1不起作用

时间:2016-05-19 作者:GDY

我得到了这个:

$pagination_args = array(
    \'base\'            => \'%_%\',
    \'format\'          => \'?listpostspage=%#%\',
    \'total\'           => $the_query->max_num_pages,
    \'current\'         => $paged,
    \'show_all\'        => false,
    \'end_size\'        => 1,
    \'mid_size\'        => 2,
    \'prev_next\'       => true,
    \'prev_text\'       => __( \'Zurück\', \'Theme\' ),
    \'next_text\'       => __( \'Weiter\', \'Theme\' ),
    \'type\'            => \'plain\',
    \'add_args\'        => false,
    \'add_fragment\'    => \'\'
);
奇怪的是,第一页的链接总是即时消息当前所在的页面?怎么了?

1 个回复
最合适的回答,由SO网友:GDY 整理而成

基础是问题:

\'base\' => add_query_arg(\'listpostspage\',\'%#%\'),
以下是完整代码:

$pagination_args = array(
    \'base\'            => add_query_arg(\'listpostspage\',\'%#%\'),
    \'format\'          => \'?listpostspage=%#%\',
    \'total\'           => $the_query->max_num_pages,
    \'current\'         => $paged,
    \'show_all\'        => false,
    \'end_size\'        => 1,
    \'mid_size\'        => 2,
    \'prev_next\'       => true,
    \'prev_text\'       => __( \'Zurück\', \'Theme\' ),
    \'next_text\'       => __( \'Weiter\', \'Theme\' ),
    \'type\'            => \'plain\',
    \'add_args\'        => false,
    \'add_fragment\'    => \'\'
);
感谢前往raison 在stackoverflow谁发布了这个answer.

相关推荐

change pagination url

目前,我的分页页面URL为:http://www.example.com/category_name/page/2但我需要将此URL结构更改为:http://www.example.com/category_name/?page=2等有什么解决方案吗?