Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Custom Fields search plugin question WordPress

  • SOLVED

Hello,
I'm using the [[LINK href="http://wordpress.org/extend/plugins/wp-custom-fields-search/"]] custom fields search plugin[[/LINK]] to return numerical results. (like you would see on a realtors site). What I can't figure out how to do is display these results from Highest price to lowest price on the search page.

On the other archive pages I have used this to get the correct order.
ORDER BY $wpdb->postmeta.meta_value+0 DESC

But when I use this in the search page, it resets the query.

The Plugin settings are.
1. numeric
2. morethan
3. The custom field is called meta_search

Answers (1)

2011-08-17

Julio Potier answers:

Hello

I think you search page (in your theme) should be modified.
before the "while have_posts()" try to add this :
query_posts($query_string . '&meta_key=meta_search&orderby=meta_value_num&order=DESC');
This will modify the query to sort posts by meta_field, numerically.

See you !


ktp12345 comments:

That did it.. Thanks!