WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How do I sort multiples pages?

I want to allow users to sort a long list of posts (that are displayed on multiple pages) by custom fields.

Here is my form...

<form method="post" id="order">
  <select name="sort" onchange='this.form.submit()'>
    <option value="">Sort by</option>  
    <option value="zip">Sort by Zip Code</option>
    <option value="type">Sort by Property Type</option>

I was told that I need to use sessions. However, I don't know how to code this. Could anyone give me an example based on the form above?

share|improve this question

marked as duplicate by toscho Dec 7 '12 at 19:41

This question was marked as an exact duplicate of an existing question.

Never submit a form onchange. It will be very hard for keyboard users to reach the third item. – toscho Dec 6 '12 at 21:07
we need a little bit more information... its not an issuse to sort posts using select but what are those parameters?... custom fields? meta boxes? if you wanted to can you create a loop that would show post by zip code by default? what does that even mean? does that mean that 15758 would be before 25841 ? – Sagive SEO Dec 6 '12 at 22:13
As my first sentence indicated, the posts will be sorted by "custom fields" (i.e., zip code, property type, property name, etc.) For zip code, it simply means that the posts will be sorted in numeric order. So, yes, zip code 15758 would be before 25841. Thanks so much. – user24526 Dec 6 '12 at 22:25
All the code is in the answer to you other question here: wordpress.stackexchange.com/questions/73367/… – toscho Dec 7 '12 at 19:41

You can add a query to the URL in WordPress, and then just link to that query, see – http://codex.wordpress.org/Function_Reference/add_query_arg

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.