gpt4 book ai didi

Wordpress query_posts 按自定义字段排序

转载 作者:行者123 更新时间:2023-12-03 08:22:02 25 4
gpt4 key购买 nike

我正在尝试通过自定义字段使用 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

出了什么问题?

提前致谢!

最佳答案

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

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

关于 SO 的另一个答案.

关于Wordpress query_posts 按自定义字段排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10970566/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com