spacedmonkey / wp-rest-blocks
将gutenberg块数据添加到文章/页面/小工具REST API端点。
1.0.2
2024-04-20 14:43 UTC
Requires
- php: ^7.0 || ^8.0
- composer/installers: ^1.10
- tburry/pquery: ^1.1
Requires (Dev)
- dev-master
- v2.x-dev
- 1.0.2
- 1.0.1
- 1.0.0
- 0.5.0
- 0.4.0
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.2
- 0.1.1
- 0.1.0
- dev-dependabot/npm_and_yarn/wordpress/scripts-30.0.2
- dev-dependabot/npm_and_yarn/multi-9423f4c335
- dev-dependabot/npm_and_yarn/multi-cf87d80143
- dev-dependabot/npm_and_yarn/multi-d66d039ac5
- dev-dependabot/npm_and_yarn/wordpress/scripts-29.0.0
- dev-dependabot/npm_and_yarn/webpack-5.94.0
- dev-dependabot/npm_and_yarn/minimatch-10.0.1
- dev-dependabot/composer/composer/installers-tw-2.3
- dev-fix/wp-version
- dev-fix/php-version
- dev-block_data
- dev-try/cache-posts
- dev-fix/first-release
- dev-build-plugin
- dev-improve-code
This package is auto-updated.
Last update: 2024-09-23 19:56:50 UTC
README
贡献者:spacedmonkey 捐赠链接:https://github.com/sponsors/spacedmonkey 标签:blocks, gutenberg, api, wp-json, rest-api 需求至少:5.5 测试到:6.5 需求PHP:7.0.0 稳定标签:1.0.2 许可证:GPLv3或更高 许可证URI:https://gnu.ac.cn/licenses/gpl-3.0.en.html
将gutenberg块数据添加到文章/页面REST API端点。
描述
一个简单的插件,将块数据以json格式添加到REST API中。安装后,REST API将新增两个新字段:has_blocks
和blocks
。例如输出。
"has_blocks": true,
"block_data": [
{
"blockName": "core/image",
"attrs": {
"url": "https://www.spacedmonkey.com/wp-content/uploads/2018/12/test-image.jpg",
"alt": "Terminal de aeropuerto",
"caption": "fsfsdfdsfdssfd",
"href": "https://www.spacedmonkey.com/test-image",
"rel": "noreferrer noopener",
"linkClass": "jonny-123",
"linkTarget": "_blank",
"id": 147355,
"width": 582,
"height": 327,
"linkDestination": "attachment"
},
"innerBlocks": [
],
"innerHTML": "\n<figure class=\"wp-block-image is-resized\"><a class=\"jonny-123\" href=\"https://www.spacedmonkey.com/test-image\" target=\"_blank\" rel=\"noreferrer noopener\"><img src=\"https://www.spacedmonkey.com/wp-content/uploads/2018/12/test-image.jpg\" alt=\"Terminal de aeropuerto\" class=\"wp-image-147355\" width=\"582\" height=\"327\"/></a><figcaption>fsfsdfdsfdssfd</figcaption></figure>\n",
"innerContent": [
"\n<figure class=\"wp-block-image is-resized\"><a class=\"jonny-123\" href=\"https://www.spacedmonkey.com/test-image\" target=\"_blank\" rel=\"noreferrer noopener\"><img src=\"https://www.spacedmonkey.com/wp-content/uploads/2018/12/test-image.jpg\" alt=\"Terminal de aeropuerto\" class=\"wp-image-147355\" width=\"582\" height=\"327\"/></a><figcaption>fsfsdfdsfdssfd</figcaption></figure>\n"
],
"rendered": "\n<figure class=\"wp-block-image is-resized\"><a class=\"jonny-123\" href=\"https://www.spacedmonkey.com/test-image\" target=\"_blank\" rel=\"noreferrer noopener\"><img src=\"https://www.spacedmonkey.com/wp-content/uploads/2018/12/test-image.jpg\" alt=\"Terminal de aeropuerto\" class=\"wp-image-147355\" width=\"582\" height=\"327\"/></a><figcaption>fsfsdfdsfdssfd</figcaption></figure>\n"
}
],
技术说明
- 需要PHP 5.6+。
- 需要WordPress 5.5+。
- 在GitHub仓库:[https://github.com/spacedmonkey/wp-rest-blocks](https://github.com/spacedmonkey/wp-rest-blocks) 欢迎提交问题和拉取请求
安装
使用WordPress仪表盘
- 导航到插件仪表盘中的“添加新插件”
- 搜索“wp-rest-blocks”
- 点击“立即安装”
- 在插件仪表盘中激活插件
在WordPress仪表盘中上传
- 导航到插件仪表盘中的“添加新插件”
- 导航到“上传”区域
- 从您的计算机中选择
wp-rest-blocks.zip
- 点击“立即安装”
- 在插件仪表盘中激活插件
使用FTP
- 下载
wp-rest-blocks.zip
- 将
wp-rest-blocks
目录解压到您的计算机上 - 将
wp-rest-blocks
目录上传到/wp-content/plugins/
目录 - 在插件仪表盘中激活插件
屏幕截图
- 向REST API添加字段。
变更日志
1.0.2
- 修复WordPress 6.5的问题
- 将编码标准更新到WP编码标准3.1.0
- 标记测试到WP 6.5
1.0.1
- 将编码标准更新到WP编码标准3.0.1
- 标记测试到WP 6.4
1.0.0
重大更改!REST API中的字段从blocks
更改为block_data
。
0.5.0
- 支持WordPress 5.9中添加的新帖子类型。
0.4.0
- 添加了对WordPress 5.8中添加的基于块的widget的支持。块数据添加到/wp/v2/widgets端点。
0.3.2
- 更新翻译
0.3.1
- 热修复。
0.3.0
- 改进对具有使用查询源类型的属性的块的支撑。
- 改进对未使用composer安装此插件的用户的错误处理。
0.2.1
- 更新依赖关系。
0.2.0
- 重大更改。字段名称已更改,并要求WordPress 5.5+。
0.1.0
- 第一个版本。