I've got a page template called tpl-memos.php which is attached to a page called 'Memos' with a parent page called 'About', the permalink for the page therefor is example.com/about/memos. On this page a custom post type called 'info' is listing its posts, and this custom post type has a rewrite of '/about/memos' – the same as the page structure.

This is working pretty good: the posts from the CPT is listed and they get the correct URL, example.com/about/memos/%post_name% and of course it's a single-info.php file that is used to output the posts.

My only problem is that I can't seem to get the pagination correct, when clicking 'Previous posts' all I get is a 404 error.

Here's some code from tpl-memos.php, nothing special:

query_posts(array('post_type' => 'info', 'posts_per_page' => 10, 'paged' => $paged));

if (have_posts()):
    while (have_posts()): the_post();
        // Some content
    endwhile; ?>

    <div class="navigation">
        <span class="alignright"><?php previous_posts_link(); ?></span>
        <span class="alignleft"><?php next_posts_link(); ?></span>
<?php endif; ?>

1 Answer 1


What i found was the easiest way to solve this problem – and what i eventually ended up doing – was to build a custom pagination using querystrings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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