最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

url rewriting - Pagination 404 Not Found child page

programmeradmin1浏览0评论

I have a page Heemtijdinghen displaying custom posts (post_type=artikel) paginated. The page is a child page of page Publicaties: /publicaties/heemtijdinghen/

When navigating to e.g. page 2 a 404 Not Found is thrown: /publicaties/heemtijdinghen/page/2/ => 404 Not Found

However, pagination does work correctly when I make the child page a parent page: /heemtijdinghen/page/2/ => OK

I have no clue how to do the rewrite:

add_filter('init', 'plugin_name_add_rewrite_rules');

function plugin_name_add_rewrite_rules() {
  add_rewrite_rule('publicaties/heemtijdinghen/(.?.+?)(/[0-9]+)?/?$', 'index.php?post_type=artikel', 'top');
  add_rewrite_rule('publicaties/heemtijdinghen/([^/]+)(/[0-9]+)?/?$', 'index.php?post_type=artikel&paged=$matches[1]', 'top');
}

Help would be very much appreciated.

I have a page Heemtijdinghen displaying custom posts (post_type=artikel) paginated. The page is a child page of page Publicaties: /publicaties/heemtijdinghen/

When navigating to e.g. page 2 a 404 Not Found is thrown: /publicaties/heemtijdinghen/page/2/ => 404 Not Found

However, pagination does work correctly when I make the child page a parent page: /heemtijdinghen/page/2/ => OK

I have no clue how to do the rewrite:

add_filter('init', 'plugin_name_add_rewrite_rules');

function plugin_name_add_rewrite_rules() {
  add_rewrite_rule('publicaties/heemtijdinghen/(.?.+?)(/[0-9]+)?/?$', 'index.php?post_type=artikel', 'top');
  add_rewrite_rule('publicaties/heemtijdinghen/([^/]+)(/[0-9]+)?/?$', 'index.php?post_type=artikel&paged=$matches[1]', 'top');
}

Help would be very much appreciated.

Share Improve this question asked Feb 13, 2014 at 8:04 Henk JanHenk Jan 1
Add a comment  | 

1 Answer 1

Reset to default 0

does your query have this

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
  'posts_per_page' => 3,
  'paged' => $paged
);

query_posts($args); 

see documentation about pagination http://codex.wordpress/Pagination

发布评论

评论列表(0)

  1. 暂无评论