显示文章的缩略图。
属性
通过 block.json 中的 attributes 属性定义。
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
isLink | boolean | false | 角色: content |
aspectRatio | string | — | — |
width | string | — | — |
height | string | — | — |
scale | string | "cover" | — |
sizeSlug | string | — | — |
rel | string | "" | HTML 属性: rel。 角色: content |
linkTarget | string | "_self" | 角色: content |
overlayColor | string | — | — |
customOverlayColor | string | — | — |
dimRatio | number | 0 | — |
gradient | string | — | — |
customGradient | string | — | — |
useFirstImageFromPost | boolean | false | — |
支持功能
通过 block.json 中的 supports 属性定义。
anchor:truealign:"left"(左)、"right"(右)、"center"(居中)、"wide"(宽屏)、"full"(全宽)color:text:falsebackground:false
filter:duotone:true
shadow:truehtml:falsespacing:margin:truepadding:true
interactivity:clientNavigation:true
上下文
通过 block.json 中的 usesContext 和 providesContext 属性定义。
使用的上下文:
postIdpostTypequeryId
CSS 选择器
通过 block.json 中的 selectors 属性定义。
- 尺寸:
.wp-block-post-featured-image img - 边框:
.wp-block-post-featured-image img, .wp-block-post-featured-image .block-editor-media-placeholder, .wp-block-post-featured-image .wp-block-post-featured-image__overlay - 阴影:
.wp-block-post-featured-image img, .wp-block-post-featured-image .components-placeholder - 滤镜:
- 双色:
.wp-block-post-featured-image img, .wp-block-post-featured-image .wp-block-post-featured-image__placeholder, .wp-block-post-featured-image .components-placeholder__illustration, .wp-block-post-featured-image .components-placeholder::before
- 双色:
块标记
这是一个 动态块。它在服务器上渲染,不会在文章内容中保存 HTML。
在文章内容中,它存储为块注释:
<!-- wp:post-featured-image /-->
来源
- block.json (参考)
- 源目录 — 浏览
edit和save源文件、index.php等。