- This topic has 4 replies, 3 voices, and was last updated 3 years, 2 months ago by
Wes.
-
AuthorPosts
-
February 17, 2023 at 5:54 am #2536712
Wes
Hello,
I’m hoping to enable the template editor used by the Full Site Editing feature in GeneratePress. I understand that GeneratePress is still a classic theme, but I’ve reviewed a number of posts on this topic and believe the pitfalls of converting the theme (eg. group blocks losing their inner divs) will not be a problem for me.
At this time I’ve tried:
- Creating a theme.json file
- Running
add_theme_support( 'block-templates' );in functions.php
I was expecting the editor to become available under the Appearance > Editor menu, but it does not.
Now my guess is that the template editor may not be enabling simply because there are not configurable templates to edit in this theme. Is that right?
My use case is that I would like to integrate properly with the plugin Storefront Blocks. It allows for editing of WooCommerce category pages which normally do not use Gutenberg, but this relies on the template editor. You can see this video for a brief overview of that.
If you have any suggestions for how to enable the editor, or ideas as to why it’s not loading with my changes, I would be glad to hear them.
Thank you.
February 18, 2023 at 8:09 pm #2538401Tom
Lead DeveloperLead DeveloperHi there,
I wrote about this here a bit: https://github.com/tomusborne/generatepress/issues/389#issuecomment-1151683660
Try this code:
add_action( 'after_setup_theme', function() { add_theme_support( 'block-templates' ); } );Using the FSE template will make it so there’s absolutely nothing on the page (no header, footer etc…), you so you will need to build everything using blocks.
Let me know if that does the trick or not 🙂
February 18, 2023 at 8:22 pm #2538403Wes
Thanks Tom. I’d found that post before, and did try the code suggested. Unfortunately I didn’t notice any difference on the frontend or backend, nor did the Appearance > Editor menu appear. This is being added in the child theme’s functions.php.
Do you have any guesses as to why it’s not taking effect? It’s a fairly vanilla GeneratePress + WooCommerce site. Everything is up-to-date.
Using the FSE template will make it so there’s absolutely nothing on the page (no header, footer etc…), you so you will need to build everything using blocks.
That’s more of an effect than I anticipated, but I’m willing to see if it can be made to work. I’d like to be able to use the modern tooling provided by FSE if possible.
February 19, 2023 at 7:50 am #2538811David
StaffCustomer SupportHi there,
from my limited testing, using a Child Theme you need to:
1. Add support for HTML Templates and template parts using the following functions:
add_theme_support( 'block-templates' ); add_theme_support( 'block-template-parts' );2. Add HTML Templates to your site.
In your child theme folder you will need aTemplatesand aPartsfolder where you will save your HTML templates.
You can check the 2023 Theme folders to give you some guidance on how those look, and you can copy its templates as a starter if you like.3. Create a theme.json if necessary to add styles to core blocks.
However, from my testing, you will NOT be able to:
1. Access the Site Editor
2. Add New Template / Template Parts ( those will have to be added in the child theme )
3. Edit those Templates in the editor.You may find someone in the WordPress Support who knows better, but i get the impression its not something that WP intended or have much time for.
But if i can be frank here, Block Based themes feel like a major step backwards in comparison to using GP, GPP, GP Elements and the GenerateBlocks plugin.
And if you’re main intention is for building Woo pages, then i hate to say it, but Woo blocks don’t come with many options, they don’t use the templates/functions from the core Woo plugin ( like their Shortcodes do ) and are therefore completely detached from GPPs woo module functions and the many Woocommerce hooks and filters….
February 21, 2023 at 6:43 am #2541170Wes
Hi David,
Thanks for your message and thorough explanation. It seems that the folders were indeed the missing ingredient here to have the editor option appear. It would likely be a fair bit of work to create those templates from scratch, but at least they are not overly complicated.
I’ll need to investigate this option over time as it’s more than I can commit to right now. As it’s not officially supported though and I’m in unexplored territory, we can mark this post/ticket as resolved.
If you don’t mind, I’d like to also respond to your comment about the general direction of FSE.
First of all, I actually agree with you that the FSE approach is often more limiting than what you and Tom have built in GeneratePress. I make frequent use of Elements and hooks, and understand that GP Blocks offers advanced loop queries for page building.
I also know that from your side, it must be frustrating to see Automattic reimplementing a lot of this work but in a completely different fashion. Their Global Styles system pales compared to the GP Dynamic Typography manager, for example, and the puzzle piece system they’ve implemented for templates likely limits you on some optimizations and advanced features that give GeneratePress its identity. So I completely sympathize and understand the resistance to adopting FSE.
At the same time… FSE is the official option. I expect that over time it will be integrated into more and more systems. If the adoption of Gutenberg is anything to go by, then FSE will be ubiquitous in a few years, too.
I worry that the further we get off the official path, the more hacks will be needed to maintain feature parity or compatibility. I’m already seeing plugins that are built to integrate with the FSE, and I don’t expect that will slow down.
You’re right that there’s still a lot of missing pieces. Woo’s blocks are still incomplete, and while I haven’t tested it myself I believe you that their hooks are incompatible. I hope all of that improves in time, and I think it’s reasonable to expect that it will.
But honestly, despite all of FSE’s current shortcomings, I don’t disagree with their vision. The ability to assemble a shop or checkout page without relying on hooks and CSS would be a big upgrade. Editing a header on the spot without the abstraction of using a widget is more intuitive.
Transitory periods are always hard because they ask you to throw away a lot of work that’s already been completed. I expect it’s even worse when their vision disagrees with your own. It is my belief that adopting FSE in some capacity will be required for the long-term sustainability of the theme though. I hope you folks will continue to evaluate it in the future, and consider adoption when it makes sense for you.
Thanks for your help above, and for lending me your ear.
-
AuthorPosts
- You must be logged in to reply to this topic.