wordpress登录链接更改(WordPress区块开发说明 WordPress 5.8 的 API 更新)WordPress功能 / WordPress的自定义链接颜色和功能介绍...

wufei123 发布于 2024-06-18 阅读(5)

扩展之前在 WordPress 5.6和5.7 中实现的块支持,WordPress 5.8 引入了几个新的块标志和新选项来自定义您注册的块supports新的支持color._experimentalDuotone。

– 为您的区块添加双色调支持是一项新的实验性功能要进行测试,请将此属性设置为指定要应用双色调的CSS选择器的字符串例如,在您的块元数据中:supports: { color: { _experimentalDuotone: 。

wordpress登录链接更改(WordPress区块开发说明 WordPress 5.8 的 API 更新)WordPress功能 / WordPress的自定义链接颜色和功能介绍...

> .duotone-img } }color.link– 添加了对链接颜色的支持,这反映了color.textWP 5.6 中添加的使用和支持要在您的块中使用,请在块元数据中添加支持标志:supports:

{color:{link:true;}}您可以使用属性定义默认值,theme.json如果存在,它还将使用设置的值例如:attributes: { style: { type: object。

, default: { color: { link: #FF0000, } }稳定支撑APIWordPress 5.7 中的两个实验性功能已在 WordPress 5.8 中稳定下来

fontSize 之前 __experimentalFontSizelineHeight 之前 __experimentalLineHeight有关使用详细信息,请参阅Block Supports API 文档。

间距支持已更新和扩展以适用于服务器端块,并添加细粒度支持以单独配置边 ( top, right, bottom, left) 的间距例如:supports:{spacing:{margin:true,//

EnablemarginUIcontrol.padding:true,//EnablepaddingUIcontrol.}}以下示例仅配置了top和 的侧面支持bottom:supports: {

spacing: { margin: [ top, bottom ], // Enable margin for arbitrary sides.padding: true,

// Enable padding for all sides. } }间距supports可以使用theme.json或它自己的属性来定位特定块例如,定制top和bottom余量为core/separator块:。

"styles": { "blocks": { "core/separator": { "spacing": { "margin"

: { "top": "100px", "bottom": "100px" } } } } }

道具@ mkaz和 @ nosolosw 与编译此帮助 开发笔记。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

河南中青旅行社综合资讯 奇遇综合资讯 盛世蓟州综合资讯 综合资讯 游戏百科综合资讯 新闻50187