2012-06-10 92 views
5

我想通過自定義字段爲query_posts函數排序。Wordpress query_posts按自定義字段排序

這裏是我的編輯query_posts()函數:

query_posts("post_type=produkte&".$query_string."&orderby=Price&order=DESC"); 

的價格看起來像{歐元} {}美分例如1.49。

而query_posts()函數命令它不正確。其結果是有序的那樣:

0.49,1.99,0.99

到底哪裏出問題了?

在此先感謝!

+0

什麼謝赫說,這些問題經常被問到..這裏的文檔:http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters – janw

回答

8

你可以試試這個(希望它會工作/網上找到)

query_posts("post_type=produkte&".$query_string."&meta_key=Price&orderby=meta_value_num&order=DESC"); 

另一個答案上SO

相關問題