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.

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.org/Pagination

  • Yes: $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'artikel', 'paged' => $paged ); – Henk Jan Feb 13 '14 at 8:20
  • save your permalink again that will work – idontknowhow Feb 13 '14 at 8:21
  • Unfortunately, that did not do the trick. – Henk Jan Feb 13 '14 at 10:42
  • I dropped the custom URL format I used on my Custom Post Type. Now using the normal WordPress URL-logic: it works. – Henk Jan Feb 13 '14 at 10:57
  • thats good know – idontknowhow Feb 13 '14 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.