[wp-hackers] Re-ordering search results

Tom Barrett tcbarrett at gmail.com
Tue Nov 20 13:44:55 UTC 2012


I have a list of companies on a site, their profiles are stored as a custom
post type and they have several levels of membership (e.g. free, bronze,
silver, gold). Their membership is handled with a taxonomy. I want the free
text search to prioritise gold-package search results over silver (over
bronze, over free).

Is there a nice hook-able way for me to do this?

Other solutions are to:
 a) perform multiple searches (ew?)
 b) loop several times over search result?
 c) loop once and build my own set of results.

My thinking is that a simpler db query with lots of results would be better
than 4 more complex queries (but I will need the taxonomy term at some
point). So I either need to hook into pre_get_posts or loop through
$wp_query->posts?

-- 
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett


More information about the wp-hackers mailing list