-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Advances #20046
Introduction
Lists are the cornerstone of content consumption on the web: listicles, timelines, feeds, categories, search results, you name it. A block that provides a comprehensive way to show content as a list is, therefore, a cornerstone of site building with blocks.
The LatestPosts
block is one of the first blocks shipped in Gutenberg. In the time since its envisioning until today, the block outgrew its name and is no longer a list of latest posts, but also a list of oldest posts, a list of alphabetical posts, a list of posts by a certain author and/or in a certain category.
However, a new and better option to create lists has been added as part of the effort to develop the Site editor and enable full site editing: the Query block. This one, as the name suggests, is a block that allows to customize, potentially, every aspect of a WP_Query and retrieve a list of content items for display.
The difference between the Query
block and the LatestPosts
block resides not so much in the query that one can make, nor in the presentation of the list, but in the fact that the Query block leverages the new BlockContextProvider
and BlockPreview
to enable inline editing of content, directly in the list.
Since we want to get as close as possible to a perfect WYSIWYG experience across the board in WordPress, it’s obvious that the technology or path that enables this is always going to be the future.
Actions to implement the LatestPosts block as a variation of the Query block
a) Port all the current functionality in the LatestPosts block to the Query block
- layout options (list and grid)
- order by date (pr: Add order/order by support in Query block #24691)
- order by alphabetic order (pr: Add order/order by support in Query block #24691)
- filter by author (pr: Add filtering by author support in Query block #25149)
b) Add new features to the Query block instead of the LP block
- Try replacing the
LatestPosts
block with a variation of theQuery
block - [ Latest Posts ] Iterations to version 2 #20046 lists a lot of new useful things that are a great fit for building lists.