The Dream of Exporting WordPress Block Themes from the Site Editor Is Close to Reality – WP Tavern

0
407

Justin Tadlock
I have said it before, but it bears repeating: the next generation of WordPress theme authors will design from the site editor. It seems that Gutenberg project contributors are making good on my promise.
Earlier today, I exported a WordPress theme from the site editor.
The resulting ZIP file seemed to include all the necessary bits to upload and activate like any other theme.
This was a feature that I had been waiting on for months. It is a significant step toward the idea of not only democratizing publishing but bringing that same philosophy to website design.
I hesitated for only a moment to check the ZIP for anything that might need adjusting. I renamed the inner folder and the Theme Name header in style.css. Then, I dropped it into /wp-content/themes. The moment of truth was upon me as I tapped the Activate button from the WordPress admin.
No fatal errors. Whew. Activation was a success.
It was by no means perfect. It felt much like climbing that first hill in programming where you move from concept to a broken-but-somewhat-working implementation. It is often the roughest hill in the journey, but you just keep moving once you get to the top. The hard work will be worth it in the end.
I tested exporting Twenty Twenty-Two via Gutenberg Nightly. After checking the front end and the site editor, I noticed that some pieces were not there:
The bundle was missing a boatload of files, but this was expected behavior. As of WordPress 5.9, users can download their templates and template parts. Two recent enhancements to the development version of the Gutenberg plugin adds more theme files to the mix:
It is almost surprising that the “TT2 Export” theme I uploaded resembled Twenty Twenty-Two at all. It had none of the PHP files for adding features like custom patterns. Even the style.css file, while included, was not loaded.
However, this shows how powerful theme.json has become. It was still a functioning theme without all the other pieces.
This is merely the first step. One of the next tickets in line, if approved, will [maybe] export the entire theme contents. Like its predecessors, it has its own kinks. Such an export presents challenges when the theme has anything beyond the standard features. This can be anything from class/function naming to autoloading to missing scripts.
The latest code from the pull request will ignore .git, vendor, and node_modules directories in exports. This could change how some creators build themes altogether, particularly as the system continues evolving.
Last week, we discussed whether 1,000s of block themes were necessary. The idea stemmed from a goal set by project co-founder Matt Mullenweg in the 2021 State of the Word, where he said that the directory would have 300 or, ideally, 3,000. This was after mentioning 5,000 earlier in the address when referencing the then-28.
Since then, WordPress has adopted a more official goal of 500 themes in the directory for 2022. That feels ambitious enough to be challenging but not impossible.
One of the easiest ways to achieve it and those loftier numbers is to hand the keys to the design kingdom over to literally everyone. Well, anyone with access to the Appearance > Editor admin screen in WordPress.
If a fully-featured theme exporter lands in WordPress this year, it could birth that next generation of creators the project needs.
Another ticket proposes that the site editor overwrite template files directly in the theme when a “developer mode” is enabled. This could help current theme developers transition to building more block themes. Exporting templates in a ZIP file is not part of the typical theme designer’s workflow. Nor is copying block code from the editor to paste into files. Having WordPress write template files to the system would cut out some of the dirty work.
I would rather have the latter feature before theme exports. However, that is the developer in me talking. The end goal should be to empower as many people as possible to design.
I can dig it.
This is so profound. I think there’s a huge market to design a base theme that can be used by non-techies to spawn new themes. i.e a theme with lots and lots of customization options that aren’t exported when the theme is exported. That way designers could have all the power they like with the base theme, without the endless options in the resultant theme. Gonna be cool to watch this develop.
Correct, the price point for such themes would be around $2 because eventually the user can do this themselves.
I’m really about to date myself here, but this reminds me of Alex King’s stylesheet competiton for WordPress 1.2 from the pre-theme days. Swap out the stylesheet and give the blog an entirely new look. (I used Minz Meyer’s “Mars Spirit” layout for a few months back in those heady 1.2 days.) While the theme building here is more design and less code, the swappable json of the block themes here and in the previous post make me think we’ve come full circle, in a way, to the universality of early WordPress where all you needed was a new stylesheet.
I’m still just looking for a way to play around with site editor on a running WP site without having that block theme be the active one for all visitors. Feels like there should be some easy way I’m not aware of
The split between FSE themes and traditional themes can become a big problem in my eyes.
Of course the difference is very big, but now it loses the familiar interface for users, because the customizer is completely replaced with the site and template editor.
Only for new users this is no problem.
Your email address will not be published.





document.getElementById( “ak_js_1” ).setAttribute( “value”, ( new Date() ).getTime() );
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Enter your email address to subscribe to this blog and receive notifications of new posts by email.


WordPress Tavern is a website about all things WordPress. We cover news and events, write plugin and theme reviews, and talk about key issues within the WordPress ecosystem…
© All Rights Reserved. Powered by WordPress, hosted by Pressable

source

LEAVE A REPLY

Please enter your comment!
Please enter your name here