【问题标题】:Wordpress query_posts Order By Custom FieldWordpress query_posts 按自定义字段排序
【发布时间】:2012-06-10 17:04:56
【问题描述】:

我正在尝试通过自定义字段使用 query_posts 函数对结果进行排序。

这是我编辑的 query_posts() 函数:

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

价格看起来像 {Euro}。{Cent} 例如 1.49。

并且 query_posts() 函数的命令不正确。结果是这样排序的:

0.49、1.99、0.99

出了什么问题?

提前致谢!

【问题讨论】:

标签: wordpress sql-order-by


【解决方案1】:

你可以试试这个(希望它能工作/在网上找到)

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

SO 上的另一个答案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-28
    • 2015-08-11
    • 1970-01-01
    相关资源
    最近更新 更多