Create Topic

WP Tavern Forums Create Topic

Create New Topic

Steve Grant

Hi Matías ,
From memory – as this was a while back (Gutenberg Version 10.9.1 ) so I’m sure everything about templating has changed many times in the intervening …. 8 weeks!!

I think the largest roadblock was that anything programmatic in the theme required me to make a block. For example the site I was making: the home page needed to display different content to different levels of member, and also personalised content such as : “hello USERNAME, here are the stories since you last visited” + a call from an external LMS to show members subscribed course news.

To achieve that in an old theme involved me writing a php function to render the relevant content against the user ID / user capabilities. Then I place the render_user_content(); into the home template.(not to imply old themes are “good”) That process would take me a couple of hours.
Now, to accomplish that with the new system I need to open a command prompt, update my Node install, debug why that’s acting so weird as I’ve not used it since February, decide which is the most up to date NPX for creating a block, try to remember which I’ve tried and disliked, look up my notes where I scored them all, decide was it “create-block ” or “create-wordpress-block” / “wp-scaffold-block” or … etc. etc. Discover that the one I rated highest in october 2020 is now out of favour and all the tutorials are out of date.
Eventually get a boilerplate block running, Troubleshoot my toolchain, fail to get the plugin to update, realise I’m using the wrong Node command window. Find a paths problem in my env vars. resolve that. Shout at the sky. Pull up a tutorial to remind myself of all that command line stuff for Node which I disliked so much because I hate command lines, and am now forced to use. Update some dependencies. 4000mb of libraries download into the wrong folder again. Shout at the sky. Eventually get a Hello World boilerplate block running and feeling like this should be less arduous and fragile.

Day 2, as soon as I had a boilerplate block I started working on the JSON / partials to load the block, and I soon found that the nesting for a complex home page meant the JSON was frequently invalid due to fumbled closures. I did not have a decent JSON tree viewer in my chosen IDE (Atom) so I spent a good while chasing closures. The file was so large that the nesting was illegible. I used an online validator service instead to lint it.

Day 3. I got that block up and running I noticed there was no sign of the menu editor any more. That was the week the old menu editor got removed and replaced with the new block editor , but in the theme I’d made there was simply not a sign of the new menu editor.
Appearance now only had items for “Themes, Templates, Template Parts, Theme Editor” .. and no way to edit the menu. Assuming I had somehow disabled it in the JSON I spent time chasing that and failed. I re-activated TT1 Blocks theme and Appearance -> menu was absent there too! So I googled “what is the new location of menu WP 5.8” etc. to no avail. I, a WP dev for about 15 years, have no idea where the menu is in the admin!!

I blundered around the “Site Editor (Beta)” section expecting to discover it, but only to get lost in the UI which I found massively confusing. There was no “menu” block at all, only blocks for Page Link, Home Link, Custom Link, etc. No “menu”. No place I could find a back door to trigger a path to /nav-menus.php or any equivalent.
Visitng that URL directly told me “Your theme does not support navigation menus or widgets.” The theme was TT1 blocks. The error did not take me to the new secret nav menu location. It had no clues.

Now, I never solved that – but I remembered that I needed to programmatically append to my menu (so that “Sign In” become “Sign out USERNAME”) . Usually this is a simple task which I’ve done 1000 times, and would take me about 10 minutes. Now it seemed that there was no menu any more, I simply could not find it – so I would need to create my own menu blocks with conditionals, and also find a way to edit them – now that the interface is in a special secret place.

So , after a week I looked at what I had accomplished and discovered it was zero.

The next monday I archived that work and started from scratch using the old system and by monday afternoon I had a theme, a menu with contextual links, a homepage calling user content. Sure the old system is old, but it works, it’s reliable, its simple. It does the job.

My toolchain? Local by Flywheel and Atom. That was it. No spinning up of anything, no compiling or transpiling, no online linters, no path errors, no dependencies to update.

That was my experience with the new template system in June, and it was not reassuring. I did not feel there was the stability or support to build a mission critical website on top of.

I think the tooling and the UI need simplification and clarification.






Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.