I need some guidance with sorting posts by custom field. I've read numerous similar posts here on wordpress.org, I've been on other sites... lets get to it...
I'm attempting to sort posts by a custom field using query_posts().
The custom field (base_price) is a numeric value that is a price. The sorting that happens appears to be alphanumeric with results sorted like:
I've already tried using orderby=meta_value_num and that produces the same results.
I need some sort of numerical sorting that takes into account the number of digits in the number (not just sorting by the first digit) so what is the best way to go about this?
it should be sorted like:
I've seen some similar posts where the post array was then resorted (after the query) and I've seen some suggestions about using a custom sql query (not using query_posts). Any input or suggestions from the community? How have you chosen to overcome this, if you've faced this before? It seems to me that the DEFAULT behavior of meta_value_num is not sufficient (if you then have to do more steps to get a better sort!).