大网数据广告活动
网站运营与故障问答

Custom query for Visual Composer's Post Grid in Word Press

· 52CE 我爱测

A site in Word Press. It has several custom post types. Each of them has several taxonomies that, coincidentally, are the same. Specifically: - Press <-- CPT - Country <-- Taxonomy - Theme - Department - Resources - Country - The…

问题原文

原帖链接 · Alvaro · CC BY-SA 3.0

A site in Word Press. It has several custom post types. Each of them has several taxonomies that, coincidentally, are the same. Specifically:

 - Press <-- CPT
    - Country   <-- Taxonomy
    - Theme 
    - Department

- Resources
    - Country
    - Theme
    - Department

I'm using Visual Composer and need to use the Post Grid module, which lets you create a custom query in "one-line" format such as posts_per_page=3&post_type=post&post_status=publish&orderby=date&order=DESC

THE QUESTION

What's the one-line query to output the most recent 5 posts from BOTH custom post types within the taxonomy "Country"?

已采纳解答

原帖链接 · Alvaro · CC BY-SA 3.0

Found the answer! The string has to be URL-encoded containing an array for the field "post-type" and also the "[ ]" characters are not allowed so must output the url-encoded value which is %5B%5D.

post_type%5B%5D=press
&post_type%5B%5D=resources
&cat=country
&post_status=publish
&order_by=date
&order=DESC

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2017-02-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。