【发布时间】:2018-07-13 16:44:42
【问题描述】:
我有一个带有以下 custom_post_type 父子结构的 wordpress 网站:
Brand (main parent post)
Product (child post of Brand, but parent post for versions)
Version (child post of Product)
Version (child post of Product)
Version (child post of Product)
...
每个版本的子帖子都有一个$price post_meta 字段,具有不同的值。
我想在产品页面级别显示“From $lowestPrice to $highestPrice”的文字
我的问题是:
如何在所有版本子帖子 post_meta 字段中检索 $price 的最低和最高值,以便构建 $lowestPrice 和 $highestPrice 的值
我知道 wp_query 或类似的东西会起作用?
我希望我很清楚:)
非常感谢您的帮助!
最好的问候,
克里斯。
【问题讨论】:
-
是的,WP_Query 是我在这种情况下会采用的方式。查看文档,如果您遇到问题,请更新您的问题(最好也包含一些代码),我们会为您提供帮助。
标签: wordpress