Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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>
  </select>
</form>

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 has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
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
add comment

1 Answer

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
add comment

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