Wordpress query_posts Order By Custom Field
10,040
You may try this (hopefully it'll work/found online)
query_posts( "post_type=produkte&".$query_string."&meta_key=Price&orderby=meta_value_num&order=DESC" );
Another answer on SO.
Author by
Jings
Updated on June 21, 2022Comments
-
Jings almost 2 years
i'm trying to order my results with query_posts function by a custom field.
Here is my edited query_posts() function:
query_posts( "post_type=produkte&".$query_string."&orderby=Price&order=DESC" );
The Price looks like that {Euro}.{Cent} for example 1.49.
And the query_posts() function orders it not right. The result is ordered like that:
0.49, 1.99, 0.99
What is going wrong?
Thanks in Advance!