0

I've developed a custom post type for WordPress that has quite a few entries that require pagination. I used the *paginate_links* function and it creates the pagination appropriately, rendering links that look like this:

http://mysite.com/people/page/5/

But whenever one of the links is clicked on it returns a 404 message error. I suspect this has something to do with permalinks and my .htaccess file, but the permalinks for my posts and pages work just fine, so I'm confused.

Can anybody help me with this? Thank you!

EDIT: Here is my query:

query_posts('post_type=peoplemanager&meta_key=people_lastname&orderby=meta_value&order=ASC&paged=' . get_query_var('paged'));

The name of the page where the output is displayed is "people."

8
  • @mcleodm3 Can you add your post query. And make sure you don't have a page and a post with the same url. So if you have a post type movies making the url /movies/name-of-movie make sure you don't have a page with the same url /movies Commented Jan 6, 2011 at 18:23
  • Sure thing, I'll edit the post to include it.
    – mcleodm3
    Commented Jan 6, 2011 at 18:31
  • Your query looks ok, but it seems that your url for your post type is /people and the first page that you're displaying the posts is /people/%postname%. if that's the case try changing one of the URL/permalinks from /people to something else and see if it's fixed it. Commented Jan 6, 2011 at 19:15
  • Thanks for your response. You are correct about the URLs, that is how I want them to be formatted. What would you suggest changing the permalink to? I'm sorry for my confusion, I am quite new at this.
    – mcleodm3
    Commented Jan 6, 2011 at 19:23
  • "People" could be the main page and the single links could be "person". In your custom post type array where it says 'rewrite' => array("slug" => "people") change people to person or anything. I read there's a way to not have to change the permalinks but I've never tried it, so I can't guarantee it works. This is the link: wordpress.org/support/topic/… Commented Jan 6, 2011 at 19:40

2 Answers 2

1

As a starter, I recommend you review the discussion on a similar question regarding custom taxonomies and custom post types: Fixing Pagination with Custom Taxonomy Archive.

You'll probably need to work with the global rewrite/query variables and arguments to get things to work correctly.

3
  • Thanks for the pointer. I looked the discussion over and it does seem like $wp_rewrite->add_rule() is the key, but there's a regular expression in there I don't understand, nor am I sure I understand what's being rewritten (the index.php file it points to).
    – mcleodm3
    Commented Jan 6, 2011 at 18:40
  • Every request for a WordPress post or page passes through the index.php file at the root of the WordPress installation. You just append your query variables to that (i.e. ?p=123 tells WordPress to load a post/page with the ID 123).
    – EAMann
    Commented Jan 6, 2011 at 18:44
  • That makes sense. How would I get the variables back to my list page? Would it be something like mysite.com/people/index.php?page=2 ? And if so, is there any way paginate_links() can just create those links so I avoid the rewrite? Sorry for the confusion.
    – mcleodm3
    Commented Jan 6, 2011 at 19:27
0

You should try native custom post type indexes, which are coming with WP 3.1.

0

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.