跳转到主要内容

Latest Posts


Display a list of your most recent posts.

  • Name: core/latest-posts
  • Category: widgets
  • API Version: 3
  • Block Type: Dynamic (server-rendered)
  • Keywords: recent posts

Attributes

Defined via the attributes property in block.json.

Attribute Type Default Description
categories array — —
selectedAuthor number — —
postsToShow number 5 —
displayPostContent boolean false —
displayPostContentRadio string "excerpt" —
excerptLength number 55 —
displayAuthor boolean false —
displayPostDate boolean false —
order string "desc" —
orderBy string "date" —
displayFeaturedImage boolean false —
featuredImageAlign string — Enum: left, center, right
featuredImageSizeSlug string "thumbnail" —
featuredImageSizeWidth number null —
featuredImageSizeHeight number null —
addLinkToFeaturedImage boolean false —

Supports

Defined via the supports property in block.json.

Block Markup

This is a dynamic block. It is rendered on the server and does not save HTML in post content.

In post content, it is stored as a block comment:

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

Source