diff --git a/packages/block-library/src/latest-posts/block.json b/packages/block-library/src/latest-posts/block.json index 0eef67f6d8eb2..fbe711ee99788 100644 --- a/packages/block-library/src/latest-posts/block.json +++ b/packages/block-library/src/latest-posts/block.json @@ -1,4 +1,5 @@ { + "apiVersion": 2, "name": "core/latest-posts", "category": "widgets", "attributes": { diff --git a/packages/block-library/src/latest-posts/edit.js b/packages/block-library/src/latest-posts/edit.js index c5f012764676a..41e79e4e8ba54 100644 --- a/packages/block-library/src/latest-posts/edit.js +++ b/packages/block-library/src/latest-posts/edit.js @@ -400,7 +400,15 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) { ); - const blockProps = useBlockProps(); + const blockProps = useBlockProps( { + className: classnames( { + 'wp-block-latest-posts__list': true, + 'is-grid': postLayout === 'grid', + 'has-dates': displayPostDate, + 'has-author': displayAuthor, + [ `columns-${ columns }` ]: postLayout === 'grid', + } ), + } ); const hasPosts = Array.isArray( latestPosts ) && latestPosts.length; if ( ! hasPosts ) { @@ -442,20 +450,12 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) { const dateFormat = __experimentalGetSettings().formats.date; return ( -
+ <> { inspectorControls } -
+ ); }