Themes Set Up for a Paradigm Shift, WordPress 5.8 Will Unleash Tools To Make It Happen – WordPress Tavern
For much of WordPress’s history, the foundational elements of building a theme have been slow to change. Every so often, developers would get a new feature, such as child themes, featured images, nav menus, and template parts. Each of these was epic in its own way. However, theme authors had ample time to adapt to these single feature introductions.
When the block editor landed, it did so with a bang. Love it or hate it, it shifted how we think about design for the web. It was not one of those one-off enhancements, regardless of how many times we were told it would “just work” with any theme. It sometimes does not technically break things. Support and integration are necessary for an ideal user experience, and theme authors have been slow to catch up.
With WordPress 5.8, theme authors are gearing up for another paradigm-shifting set of changes. Josepha Haden Chomphosy, WordPress Executive Director, announced last week that several Full Site Editing (FSE) sub-components will begin shipping with the next release.
In the latest episode of the WP Tavern Jukebox podcast, Nathan Wrigley hosted guest Anne McCarthy. He asked her to calm people’s fears over upcoming changes. “So, as an example, let’s imagine that we’re a theme developer. We may be getting concerned that themes are going to become a thing of the past, that the livelihood that we’ve created for ourselves is going to disappear before our eyes.”
It is a common question. Since the inception of Gutenberg, particularly its features that fall under FSE, themers have wondered if there would be a place at the table for them. If WordPress is moving toward a grander page-building experience, where do themes fit in? If users can change the layout or manipulate all of the styles, what is the theme’s job?
These questions are finally getting some answers. We can see the real-world changes introduced in recent months. They paint a much clearer picture, defining the role of themes in WordPress’s future.
“And for theme authors, themes are going to be so important in a full site editing world,” said McCarthy. “And one of the things I am so excited about is that there’s going to be a ton of what they’re calling…the idea of these hybrid universal themes that can work with, for example, template editing.”
She is referring to a recent discussion that makes some distinctions between universal and hybrid themes. Essentially, universal themes would work in both a classic or block editor context, depending on what the user chose. A hybrid might support parts of the block experience but have a path to becoming a universal theme that fully caters to any user down the road.
While this does not wholly address theme authors’ concerns, these are the building blocks that Gutenberg contributors are thinking about. First and foremost, they want a solid user experience. However, the discussions show that they also recognize that theme developers need to opt into new things at their own pace, supporting features as they understand them and learn how to implement them. This provides a path forward for traditional themes to transition into the new era and be built from scratch with new tools.
Themes may well be more vital to WordPress’s future than they were in the past.
New Tools Coming in WordPress 5.8
The site editor and global styles features are not planned to ship with WordPress 5.8. However, the upcoming release is set to introduce some powerful tools for theme authors. This will be a pivotal moment for theme development companies that want to make their mark in the space. The right team with a forward-looking mindset stands to disrupt the market and make millions. And, there is room for the authors who just want to build cool stuff.
It all starts with the new template-related blocks that should be enabled in the next major update. In particular, the Query block provides an alternative to what was formerly only possible via code and carefully constructed theme options. Coupling it with existing features opens us to a world of possibilities.
For example, I chose a theme from the most popular list on WordPress.org that looked to have one of the most complex query and loop setups of the bunch. The following is the homepage of EnterNews:
Anyone familiar with theme development can tell you that it would take at least eight different queries to create that homepage design without looking at the code. The only way to build that and allow users to customize which posts appear is through a series of theme options (probably category-based dropdown select boxes).
If the Query block ships with WordPress 5.8 as expected and is also enabled for any theme, this layout is suddenly possible directly from the block editor — no site editor necessary. Via block patterns, users can insert these “sections” of different Query blocks in their page and reorder them. However, it requires buy-in from the theme author.
As I said earlier, theme authors have been slow to adopt block-related features as a whole. Undoubtedly, the system for the EnterNews homepage is already getting the job done. And, if it works for the theme’s current user base, there may seem to be little incentive to change.
However, there are real benefits from a development angle to transitioning to a new system. The most obvious is that it requires little code compared to the PHP needed for building customizer options. Block patterns are little more than HTML with bits and pieces of JSON configuration in the mix. Developers can literally build them from the editor and copy/paste the code part.
By writing less code, it lowers the potential for security issues and other bugs. Theme authors can also be less rigid in their design, allowing users to move pieces of the layout around.
The Query block is not the only one slated for inclusion in 5.8 outside of a block-based theme context. The Navigation, Site Title, Site Logo, and more are ready to ship. Most such blocks are vital components for building an entire page. Theme authors could start handing over the tools for building complex landing pages on launch day this July.
Not every theme author needs to step up and attempt to revolutionize the theme space — though I am looking forward to those who do. Others might want to take a more measured approach. FSE is a set of many sub-components, some of which are shipping with WordPress 5.8. Many of these do not require developers to opt into them. They will “just work.” Sort of. Mostly.
Users will be able to switch to a template-editing mode directly from the block editor. From there, they can create entire page templates of their choosing. Theme authors can either stand in their way by not styling for blocks or make the experience more enjoyable.
The widgets screen and customizer will allow end-users of traditional themes to insert blocks in any of their sidebars. Some theme authors will need to account for this in their designs. The HTML output might throw off some layouts. For those who are not ready, they should disable block-based widget support.
The most crucial tool, however, is entirely optional for theme authors. That is the introduction of
theme.json support. The
theme.json file is the cornerstone of future theme development. It acts as a config file for block settings and styles, allowing theme authors to set up the defaults for anything.
In a nutshell, theme developers can set up any of the block options from this file, and those options are automatically handled in the editor and on the front end.
Themes can also define defaults for block options that do not yet exist in the interface. The system will automatically output these as styles, even if users cannot change them in 5.8.
Again, this means less code work for themers in the long run. While there will likely always be a place for custom CSS, some themes could essentially be built from
theme.json configurations. That is not possible today. However, theme authors can start taking advantage of this tool.
Themes are not going the way of the dinosaur. All of that overly complex PHP code work necessary in the past might just be. The shift is putting themes back into their proper place: design. Previously available tools such as patterns and styles coupled with the new pieces like
theme.json and template-related blocks will be the backbone of the new system. It is all starting to come together.
The transition will take some time, and each themer will need to decide for him or herself how much they want to take on. But, the time is near. I might even crank up the old code editor and start putting together a project myself. There has never been a better time to be excited about theme development than now.
Credit: Source link