Gutenberg Contributors Explore Building More Advanced Templates – WP Tavern

0

Gutenberg design contributors are exploring how the template creation UI can be updated to expand the types of templates the user can create using the site editor. In WordPress 5.9, users can edit any template included in a theme, but creating templates is limited to a few basics:

  • cover page
  • Only
  • Page
  • Archive
  • To look for
  • 404
  • Index

Many of these base templates are already used by FSE themes. Users will only see the option to create templates (from this limited list) that their theme has not yet introduced. Opening up template building to the wider world of WordPress theme templates would allow for much more customization.

Contributors are considering adding the ability to create a category, author, tag, attachment, taxonomy, date, CPT (custom post types), templates for a specific post or page, and “general” models.

Automattic designer James Koster shared a short video demonstration of what he imagined the flow for it might look like.

“What I thought worked well was separating the models based on their specificity,” Koster said. “That is: models that have a static purpose (404, front-page, *-$slug etc) are grouped together and templates with a dynamic lens appear below.

Video credit: James Koster

“This arrangement elevates the importance of creating templates for a specific context – which I think is likely to be quite a popular flow – while also making it easy to add common templates such as page.”

He suggested that the “Advanced” section at the bottom of the menu might contain templates that are less likely to be used, such as taxonomy or date.

It’s not guaranteed to be the UI that lands for advanced template building, but it’s an exploration of how it might work.

WordPress developer Steve Graboski explained how creating CPT templates through the site editor would give users more freedom to edit the site, while reducing the number of theme files developers have to manage:

Like several other web developers, I help manage a WP Multisite implementation. If the site editor allowed developers like us to create CPT templates, it would profoundly improve our experience with WordPress.

For starters, we could remove several child themes that only exist to provide our departments with CPT layouts, archives, and research pages. The only files we would need are the plugins that define the CPTs. Who wouldn’t like a less complicated repo?

The benefits extend beyond the development team. In theory, we could offer our editors the ability to modify these CPT templates, no coding required. This would allow our non-programmer colleagues to modify template layouts without relying on our help. Publishers have more power over their sites and developers gain more productive hours.

The idea of ​​placing the creation of CPT templates in the site editor prompted discussion participants to consider making the creation of CPTs themselves more user-friendly.

“I like the idea that the kernel can provide a UI for creating CPTs, sometimes I want a CPT, but I don’t want to have to break out the code editor to do it, especially if it’s going to have much the same capabilities as a message,” said WordPress developer Aurooba Ahmed.

“Creation of models for existing CPTs look like table stakes, but also more of a developer-oriented solution because it requires the CPT to be registered first,” Koster said.

“Thinking further down the road… I wonder if there is a world where the site editor could allow users to add modules like ‘Portfolio’ or ‘Testimonials.’ These modules could register the CPT and create all the necessary templates in a single stream, and with the block templates and other tools at our disposal, we could potentially make this a pretty compelling experience.

Share.

Comments are closed.