Take the tour ×  I have the following line to change my wp query
slightly. The posts are by this ordered by the value in the
custom field "wpfp_favorites". The value is allways an integer.
Posts with value 0-9 is sorted correctly, but when a post has
value 10 (or more i guess) its not listed above posts with 9.
What is wrong? You can see the problem in "action" here:
http://hverdagskupp.no/  share|improve this question add comment
1 Answer  up vote 4 down vote accepted  take a look here:
http://codex.wordpress.org/Function_Reference/query_posts  you
need to change orderby=meta_value to orderby=meta_value_num ->
than you value gets treated as an integer not a string!   i
would pass an array instead of a string like  query_posts(
array( 'meta_key'=>'wpfp_favorites', 'orderby'=>'meta_value_num'
);  you dont have to but its easier to read and WordPress
converts that string to an array anyway....  share|improve this
answer Thanks mate! That helped :-) –  Espen Arnoy Oct 12 '10 at
12:34 glad i could help after s