Latest Posts

Display a list of your most recent posts.

This block is available in the latest version of WordPress and does not require the Gutenberg plugin.

Category:

For developers

Block Grammar & Markup

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

Block Attributes

Optional. Type: Object.

Attributes provide the structured data needs of a block. They can exist in different forms when they are serialized, but they are declared together under a common interface.

Documentation

{
  "categories": {
    "type": "array",
    "items": {
      "type": "object"
    }
  },
  "selectedAuthor": {
    "type": "number"
  },
  "postsToShow": {
    "type": "number",
    "default": 5
  },
  "displayPostContent": {
    "type": "boolean",
    "default": false
  },
  "displayPostContentRadio": {
    "type": "string",
    "default": "excerpt"
  },
  "excerptLength": {
    "type": "number",
    "default": 55
  },
  "displayAuthor": {
    "type": "boolean",
    "default": false
  },
  "displayPostDate": {
    "type": "boolean",
    "default": false
  },
  "postLayout": {
    "type": "string",
    "default": "list"
  },
  "columns": {
    "type": "number",
    "default": 3
  },
  "order": {
    "type": "string",
    "default": "desc"
  },
  "orderBy": {
    "type": "string",
    "default": "date"
  },
  "displayFeaturedImage": {
    "type": "boolean",
    "default": false
  },
  "featuredImageAlign": {
    "type": "string",
    "enum": [
      "left",
      "center",
      "right"
    ]
  },
  "featuredImageSizeSlug": {
    "type": "string",
    "default": "thumbnail"
  },
  "featuredImageSizeWidth": {
    "type": "number",
    "default": null
  },
  "featuredImageSizeHeight": {
    "type": "number",
    "default": null
  },
  "addLinkToFeaturedImage": {
    "type": "boolean",
    "default": false
  }
}

Block Supports

Optional. Type: Object.

A set of options that enables or disables block controls in the editor, for example gradient colors or padding.

Documentation

{
  "align": true,
  "html": false,
  "color": {
    "gradients": true,
    "link": true,
    "__experimentalDefaultControls": {
      "background": true,
      "text": true,
      "link": true
    }
  },
  "spacing": {
    "margin": true,
    "padding": true
  },
  "typography": {
    "fontSize": true,
    "lineHeight": true,
    "__experimentalFontFamily": true,
    "__experimentalFontWeight": true,
    "__experimentalFontStyle": true,
    "__experimentalTextTransform": true,
    "__experimentalTextDecoration": true,
    "__experimentalLetterSpacing": true,
    "__experimentalDefaultControls": {
      "fontSize": true
    }
  }
}