Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:

<?php
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>
    </div>
<?php endif; ?>
share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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