WordPress 6.0 might come with a feature to choose a block template during page creation – WP Tavern

I once said that full-page templates were the missing link for block theme development. Theme authors have been able to include such layouts since the templates feature was rolled out in WordPress 5.5 last year. However, WordPress core never provided an experience built around them.

That might change when WordPress 6.0 ships next month. There’s a bit of a push at the 11th hour to land the first iteration of the feature. It should come with Gutenberg 13.0 and WordPress 6.0-beta-1 for testing (grab the nightly Gutenberg ZIP to test now).

Earlier this week, Jorge Costa merged an implementation that brought full-page templates into the page authoring experience.

Modal model when adding a new page.

There doesn’t seem to be an official name for this new feature. “Full page” may not be the most appropriate terminology. In reality, it is more of a content model inserter.

The goal is to present users with pre-made layouts that they can insert and customize – plug-and-play style. A modal appears when creating a new page if the theme has registered templates for content. Inserting is as easy as finding a starting point and clicking.

WordPress page editor with a complete template inserted into the content canvas.  It features a colorful background and centered section for profile content.
Inserting a content template when creating the page.

Of course, users can also choose to start fresh as usual by tapping 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 missed a few steps to create an ideal user experience. This new feature could close the gap in a way we haven’t seen before.

Want to create this portfolio page from the theme demo? Just go to Pages > Add New, select the portfolio template and you have it.

Want this contact layout? Yes, same process.

There are still a few pieces of the puzzle to figure out. Most notable is the initial user experience. There should be an option to turn it off 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 insertion module currently only appears for pages.

Chances are the feature will land in WordPress 6.0 as it doesn’t add any new APIs or special template categories. Instead, it relies on the existing blockTypes flag when saving custom patterns.

Theme authors who want to give it a spin can save templates for the core/post-content block type:

register_block_pattern( 'namespace/slug', [
        'blockTypes' => [ 'core/post-content']
        // ...
] );

After spending more time than I’m willing to admit testing the feature, I’m happy with the initial implementation. In the long run, there might be more it could do.

When I think of starting points like this, I often want to cede control of the entire page’s output. This includes everything from header to footer. Remember that this feature focuses directly on the content. Depending on the theme, such templates can work well with a “blank” template:

WordPress page editor.  The page sidebar panel highlights the template section.  A blank template is selected.
Selection of an “Empty” page template.

Templates like this are usually open canvases that display content only. In a possible future version, I would like to be able to trigger the selection of such a blank pattern when specific patterns are chosen. Or, perhaps, there could be a mechanism to choose between “content” and “full page” templates.

For now, allowing users to select a template when creating the page is definitely a boon for theme authors. It makes me want to get back into the theme development game a bit, if only to see what limits I can push with it.

Comments are closed.