Title: tutorial needed
Last modified: August 21, 2016

---

# tutorial needed

 *  [tayssir.ch](https://wordpress.org/support/users/tayssirch/)
 * (@tayssirch)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/tutorial-needed/)
 * hello dear,
    am using custom post type, custom taxonomies, and 2 meta value :
   carprice , carmilieage after searching, i need to sort result by price / milieage
   but i wish if can i have drop down, with string &orderby=carprice&order=asc can
   anyone send me tutorial link or code ? thanks

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/tutorial-needed/#post-4085726)
 * I can’t direct you to any tutorials or offer any code, but I can outline the 
   the general process. Perhaps you will have more luck finding information about
   the various parts in isolation and then be able to piece together a complete 
   solution.
 * You can add a drop down to the search form by hooking into the ‘get_search_form’
   filter. If needed, you could setup your filter callback to only add the drop 
   down when search results are being displayed.
 * In order to actually affect the sort field and order, hook into the ‘pre_get_posts’
   action and check query variables to determine if the query is to get search results.
   If so add or change query variables so the desired query is fashioned. Query 
   variables are very similar to custom WP_Query arguments.
 * In case your needs cannot be met by setting query variables, you can also alter
   the actual query string by using various ‘posts_*’ filters, in your case probably‘
   posts_orderby’ and possibly ‘posts_join_paged’.
 * I believe you’ll have an easier time finding information on these specific tasks
   rather than the complete process.

Viewing 1 replies (of 1 total)

The topic ‘tutorial needed’ is closed to new replies.

## Tags

 * [meta_value)](https://wordpress.org/support/topic-tag/meta_value/)
 * [orderby](https://wordpress.org/support/topic-tag/orderby/)
 * [string](https://wordpress.org/support/topic-tag/string/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/tutorial-needed/#post-4085726)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
