I would like to add sorting but don't have any idea how ot go about it. I would like to be able to sort by:

Date, Title, Price (custom field), Comments, Views, ASC + DESC

What would be the best way to do something like this?

  • Check if this could help you - wordpress.stackexchange.com/q/57850/17968
    – Amit Kosti
    Aug 19, 2012 at 15:43
  • can you paste more information like the loop of the page / post where you want to add sorting
    – Sagive
    Aug 19, 2012 at 16:53
  • @SagiveSEO like what?
    – Joe Bobby
    Aug 19, 2012 at 17:31
  • @amit i tried site.com/?orderby=title&order=dsc and it went the the blog page and sorted.. this is a custom post type how do i get it to sort on the same page?
    – Joe Bobby
    Aug 19, 2012 at 17:37
  • you can pass an extra parameter post_type, See my answer below
    – Amit Kosti
    Aug 19, 2012 at 18:45

1 Answer 1


Extending this answer for custom post type support.

For a custom post type you can pass an extra parameter ( post_type ) to url, example -


Note - If you've specified some url rewrite for that post type then the above url will become something like this but still showing all posts of post type FOO with descending order by title.

  • this works, but is there any php I can add for sorting? I only got it to work by trying <a href="http://site.com/?post_type=portfolio&orderby=title&order=dsc">test</a>
    – Joe Bobby
    Aug 19, 2012 at 22:05
  • I didn't get you ? Do you want get this done without using url parameters ? I think this is best way to make posts sortable using a click.
    – Amit Kosti
    Aug 19, 2012 at 22:32

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.