添加用户的头像。

  • 名称: core/avatar
  • 类别: 主题
  • API 版本: 3
  • 块类型: 动态(服务器渲染)

属性

通过 block.json 中的 attributes 属性定义。

属性类型默认值描述
userIdnumber——
sizenumber96—
isLinkbooleanfalse—
linkTargetstring"_self"—

支持功能

通过 block.json 中的 supports 属性定义。

上下文

通过 block.json 中的 usesContext 和 providesContext 属性定义。

使用的上下文:

  • postType
  • postId
  • commentId

CSS 选择器

通过 block.json 中的 selectors 属性定义。

  • 边框: .wp-block-avatar img
  • 阴影: .wp-block-avatar img
  • 滤镜:
    • 双色: .wp-block-avatar img

块标记

这是一个 动态块。它在服务器上渲染,不会在帖子内容中保存 HTML。

在帖子内容中,它存储为块注释:

<!-- wp:avatar {"userId":4, "size":85,"isLink":true,"align":"right","style":{"spacing":{"margin":{"bottom":"40px"}},"border":{"radius":"47px","width":"3px"},"color":{"duotone":["#000000","#ffe2c7"]}},"borderColor":"vivid-red"} /-->

来源