Possible, to be honest I didn’t have a look at the client control for a few weeks now. It’s also a bit of personal dislike of letting the clients work in the Builder! , but I’m definitely gonna have a look at it, thanks!
Yes, that’s kind of a hack you have to use. As Gutenberg only allows you to nest 1 level deep you would need to create a small workaround. What I did is the following:
- I have one wrapping block which is basically nothing different then a container with a “Block Inner Content” attribute on it. That Inner-Block Attribute allows me to specify a template inside of Pinegrow. So what I did is creating child-blocks and specify them in the template (you can also use the core Gutenberg-Blocks there for text and so)
- To ensure that those child-blocks are only used inside my container I’ve specified a parent-container on them to make sure, which hides them from the “+ add” panel if I’m not inside that parent container.
If you want to entirely hide them. there would be a feature called “multiple → false” in Gutenberg, but I wasn’t able to find that in pinegrow yet (that’s a small workaround for this problem: Gutenberg-Block: supports: multiple => false)
-
You can nest child-blocks inside those mentioned child-blocks and achieve multiple deep nested levels with that technique.
-
Register that Parent-Container (mentioned in 1.) in my plugin for the Template-Part as you did it in your snippet. So whenever the page loads it automatically adds the childs and grandchilds and so on of that parent container. And voila you’ve now a complete Page-Layout loaded inside of Gutenberg automatically!
Not sure about overriding, but that should probably also be possible. I’ve created a child-theme for testing purposes where I registered that single-**.php template. But as that job-portal should run on several different websites I’m gonna do it inside of the plugin then with a filter like single_template
I’m not sure if that also overrides the existing single-php template. You could try to run that filter with a very late by adding a priority of 999 or so. But as my single-php doesn’t exist I don’t need to override mine.
By the way if you’re interested in the plugin-structure, see screenshot below (the src folder is only to have the whole project in github available, whenever I install the plugin I won’t upload that folder too). But the export location from pinegrow is set inside that “blocks” folder and inside of functionality i have my custom code. Inside of plugin.php i use require_once()
to register the gutenberg-blocks again. Took me a while to recognize that I could do it that way, so maybe you (or someone else reading this) needs such a solution for his/her next project!