[wp-hackers] Custom permalinks with the Rewrite API

Otto otto at ottodestruct.com
Fri Oct 9 18:18:56 UTC 2009


Try this example on for size:

http://codex.wordpress.org/Custom_Queries#Permalinks_for_Custom_Archives


-Otto



On Fri, Oct 9, 2009 at 10:48 AM, Eric Martin <emartin24 at gmail.com> wrote:
> I want to be able to allow users to custom sort a group of posts by
> adding a custom rewrite rule. I'm thinking of the following structure:
>
> /some-slug/sort/title:desc/
> /some-slug/sort/date:desc/
> /some-slug/sort/downloads:desc/
>
> I have tried doing this a couple of ways, but can't seem to get it to
> work:
> - some-slug as a page
> - some-slug as a category and using permalink structure of /%category%/
> %postname%/
>
> One catch is that the sorting should still work with pagination.
> Depending on which they do first, the URI could look different:
> /some-slug/sort/title:desc/page/2
> /some-slug/page/2/sort/title:desc/
>
> I tried using an endpoint first, but that doesn't seem to work with 2
> endpoints together, which makes sense.
>
> So, I'm curious if others have done this and if there are any
> suggestions on the "best" approach. I'd love to see some examples and
> appreciate any help you can provide.
>
> On a side note, there doesn't seem to be a whole lot of good
> documentation or examples surrounding the Rewrite API. What
> information is out there (on blogs and such) is often outdated or
> misleading. Based on what I'm able to learn through this processes, I
> hope to be able to create some helpful information and examples on how
> the Rewrite API works.
>
> --
> Eric Martin
> http://www.ericmmartin.com
> http://twitter.com/ericmmartin
> _______________________________________________
> 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