显示您最近发布的文章列表。

  • 名称: core/latest-posts
  • 类别: 小部件
  • API 版本: 3
  • 块类型: 动态(服务器渲染)
  • 关键词: recent posts

属性

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

属性类型默认值描述
categoriesarray——
selectedAuthornumber——
postsToShownumber5—
displayPostContentbooleanfalse—
displayPostContentRadiostring"excerpt"—
excerptLengthnumber55—
displayAuthorbooleanfalse—
displayPostDatebooleanfalse—
orderstring"desc"—
orderBystring"date"—
displayFeaturedImagebooleanfalse—
featuredImageAlignstring—枚举:left、center、right
featuredImageSizeSlugstring"thumbnail"—
featuredImageSizeWidthnumbernull—
featuredImageSizeHeightnumbernull—
addLinkToFeaturedImagebooleanfalse—

支持功能

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

块标记

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

在文章内容中,它存储为块注释:

<!-- wp:core/latest-posts {"postsToShow":5,"displayAuthor":false,"displayPostDate":false} /-->

来源