[wp-hackers] Permalinks, Custom Post Types & Pagination

John Blackbourn johnbillion+wp at gmail.com
Wed Oct 27 06:53:25 UTC 2010

Hi Olumide,

First up, WordPress 3.1 is on target to support custom post type index
pages [1] so you won't need to use custom page templates or other
methods in the future.

In the mean time you could try using the Smarter Custom Post Types
library [2] which gives you this functionality.

Finally - I'm not sure if this will work or not on pages - in the
query on your custom page template you could try passing the 'paged'
query variable into the query:

get_posts( 'post_type=foo&paged=' . get_query_var('paged') );

This will cause the query to return the second page of results when
viewing /page/2/, etc.


[1] http://core.trac.wordpress.org/ticket/13818
[2] http://somadesign.ca/projects/smarter-custom-post-types/

On Wed, Oct 27, 2010 at 7:24 AM, Olumide Alabi <me at olumidealabi.com> wrote:
> Hi Guys,
> I'm working on a project which is pretty much wrapped up except for one
> issue.
> Let me give you a bit of background here.
> I'm using WordPress 3.0.1 and I've built a lot of the functionality needed
> on the the site into the *functions.php* file.
> I'm using about a dozen custom post types to handle different portions of
> content on the site.
> Everything works fine, except that I get a 404 error when I try to paginate
> entries.
> Take this page for example http://www.oandoplc.com/media/press-releases/
> The Press Releases are a custom post type and this page itself is a custom
> page template that lists all press releases.
> Everything works fine. If you click on any of the *Read More* buttons, it
> takes you to the actual press release which is powered by a Single Post
> Template for press releases
> The problem occurs when I try to go the next page of this list. That's where
> I get a 404.
> If I go into the Admin area and change the permalink setting to default and
> then return it to whatever it was before, Pagination starts to work but
> then, I start getting a 404 when I want to view individual press releases or
> single posts for other custom post types I've created. I don't know if this
> is because I'm using custom post types or I've just done something
> completely wrong.
> I would really appreciate all the help I can get on this.
> Thanks.
> --
> Best Regards
> Olumide Alabi
> Mobile | +234 802 359 9606
> CDMA | +234 702 838 6589
> <http://www.holidaysandcash.com/luminus>
> Chat [image: Google Talk:] luminusdadon [image: Skype:] luminusdadon
> Contact Me [image: Linkedin] <http://www.linkedin.com/in/luminus>[image:
> Facebook] <http://www.facebook.com/luminus>[image:
> Tumblr]<http://luminus.tumblr.com>[image:
> Twitter] <http://twitter.com/luminus>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list