I don’t know how to title this post properly, so I am just going to try and explain it and see if then I can have a good title. I wanted to be able to sort custom post types by the url and have it look pretty. I wanted it to look like:
http://www.com/customposttype/date/asc/
I know how to do:
http://www.com/customposttype/?sortby=date&direction=asc
The key is that I wanted it to be clean looking and now that I found out that it is relatively simple. I am going to be using this more and maybe make a plugin for it. I am just wondering out loud if this is already built into WordPress and I am being dumb (which I hope is the case, because I will really use this more and more in the sites that I make).
This goes into functions.php:
in my example above I am using the page “art” which uses a custom template. So when the URL http://youawake.com/art/date/desc/ gets called.
Now within the custom page template ART, I just need to call the variable that gets displayed and then sort it within the query, the example.
If there is no date sort it just displays it by default order.
You can see my two examples at:
http://youawake.com/art/date/desc/
http://youawake.com/art/date/asc/




I saw a