WordPress 6.0 Might Ship a Feature for Picking a Block Pattern on Page Creation
I once said that full-page patterns were the missing link for block theme development. Theme authors have been able to include such layouts since the patterns feature was rolled out in WordPress 5.5 last year. However, core WordPress has never provided an experience built around them.
This may be changing when WordPress 6.0 ships next month. There is a bit of an 11th-hour push to land the first iteration of the feature. It is expected to ship with Gutenberg 13.0 and WordPress 6.0-beta-1 for testing (grab the Gutenberg nightly ZIP to test now).
Earlier this week, Jorge Costa merged an implementation that made full-page patterns part of the page creation experience.
There does not seem to be an official name for this new feature. “Full page” might not be the most appropriate terminology. In reality, it is more of a content-pattern inserter.
The goal is to present users with pre-built layouts that they can insert and customize—plug-n-play style. A modal appears when creating a new page if the theme has any registered patterns for the content. Insertion is as simple as finding a starting point and clicking.
Of course, users can also choose to start from scratch as usual by hitting the “x” icon to close the modal.
There has always been a disconnect between what WordPress themes are capable of and users recreating what they see in the demo. Everything developers have attempted in the past—from shortcodes to theme options—has often fallen a few steps shy of creating an ideal user experience. This new feature could bridge the gap in a way that we have not seen before.
Want to build that portfolio page from the theme’s demo? Just go to Pages > Add New, select the Portfolio pattern, and you got it.
Want that contact page layout? Yeah, same process.
There are still some pieces of the puzzle to figure out. The most notable is the initial user experience. There should be an option to disable this entirely for users who prefer to start with a blank content canvas.
Riad Benguella also recommended a config flag for custom post types to enable or disable it by default. The pattern inserter only appears for pages right now.
There is a high chance that the feature could land in WordPress 6.0 because it does not add any new APIs or special pattern categories. Instead, it piggybacks off the existing
blockTypes flag when registering custom patterns.
Theme authors who want to give it a spin can register patterns for the
core/post-content block type:
register_block_pattern( 'namespace/slug', [ 'blockTypes' => [ 'core/post-content'] // ... ] );
After spending more time than I am willing to admit testing the feature, I am happy with the initial implementation. In the long term, there might be more that it could do.
When I think of starting points like this, I often want to hand over control of the entire page’s output. This includes everything from the header down to the footer. Remember, this feature focuses directly on the content. Depending on the theme, such patterns might work well alongside a “Blank” template:
Templates like this are typically open canvases that only display the content. In a possible future version, I would like to be able to trigger the selection of such a blank template when specific patterns are chosen. Or, perhaps, there might be a mechanism for choosing between “content” and “full page” patterns.
For now, allowing users to select a pattern on page creation is sure to be a boon for theme authors. It makes me want to step back into the theme development game for a bit, if for nothing other than to see what limits I can push with it.