我试图找到一些特定的插件手风琴(FAQ),但在一种形式的古腾堡块。在https://wordpress.org/plugins/browse/blocks/上有一组“启用块”插件。
应该有一个简单的方法来完成这项任务。我做了很多实验,但结果都不令人满意。
使用专用站点的
(?mi)(^\s*Plugin\s+Name:.+accordion.+$),以实现不区分大小写的accordion插件名称搜索。但是我也不能搜索“块”插件,因为有不可能实现和功能:我在谷歌的查询中得到了一些类似的结果:
inurl:wordpress.org/plugins/browse/blocks/ accordion..。但这只给了我“列表”而不是“插件”页面。一点也不满意!
我仍然相信谷歌有可能获得更好的结果。
基于
实验
我通过Wordpress.org API找到了“一些解决方案”。读我自己的答案..。
发布于 2020-05-27 02:51:11
首先,将结果提取到以下文件中:
# create a file needed
curl --globoff --silent "https://api.wordpress.org/plugins/info/1.2/?action=query_plugins&request[browse]=blocks&request[page]=1&request[per_page]=400" | jq ".plugins[] | { name: .name, url: \"https://wordpress.org/plugins/\\(.slug)/\", short: .short_description, description: .description }" > wp-block-plugins.json
curl --globoff --silent "https://api.wordpress.org/plugins/info/1.2/?action=query_plugins&request[browse]=blocks&request[page]=2&request[per_page]=400" | jq ".plugins[] | { name: .name, url: \"https://wordpress.org/plugins/\\(.slug)/\", short: .short_description, description: .description }" >> wp-block-plugins.json现在,当我有文件wp-block-plugins.json时,我可以搜索我需要的插件:
# case in-sensitive search in description field for term 'accordion'
cat wp-block-plugins.json | jq '. | select(.description | test("\\baccordion\\b";"")) |{ name: .name, short: .short, url: .url }'会给我带来这样的结果,这也是我首先想要的:
...
{
"name": "Cosmic Blocks (40+) Content Editor Blocks Collection",
"short": "Blocks collection of 40+ customizable WordPress 5.0 gutenberg content blocks for the new content block…",
"url": "https://wordpress.org/plugins/cosmic-blocks/"
}
{
"name": "Hot Blocks",
"short": "A collection of several blocks for new WordPress editor (Gutenberg).",
"url": "https://wordpress.org/plugins/hot-blocks/"
}
...发布于 2020-06-04 11:29:08
我想我找到了一个合适的地点:
有效的搜索查询:
https://pluginsearch.com/gutenberg/?query=faq到目前为止最好的解决方案!
https://wordpress.stackexchange.com/questions/367622
复制相似问题