[Resolved] Sort posts by custom field numeric value
I’m trying to customize a template category page that sorts posts within a certain category by the natural numeric order specified in a custom field. I have a realtor’s website, we’re using a post for each listing, and they want to have all the listing posts sort by price. I’ve created a custom field called ‘price’ and typed a number into each field.
Using the instructions here http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query I’m able to do this, mostly, but the posts are not in natural numeric order. The custom field value is a string, and PHP does not sort the values numerically by default.
I’m a bit of a novice with PHP, but very experienced with custom templates. Please help…
- The topic ‘[Resolved] Sort posts by custom field numeric value’ is closed to new replies.