Support » Fixing WordPress » WordPress Gutenberg Theme: Structure, Hierarchy and Custom Templates

  • I’m starting to develop a WordPress theme using Gutenberg. I’ve never worked with Gutenberg before, but since the support for Classic Editor might possibly end next year, I want to use it now since I don’t want to rebuild the same site for the client again next year. I’m using Sage 10.

    I’ve got the idea of how to build blocks (with ACF Pro or natively), but what confuses me is the theme structure/template hierarchy.

    I’ve read all the documentation here: https://developer.wordpress.org/block-editor/how-to-guides/themes/.

    But the structure with folders block-templates and block-template-parts is very confusing to me. There’s no PHP and only HTML files. I don’t see any files from the classic Template Hierarchy.

    Basically, what I want to achieve is this: create templates for posts, CPT, and custom templates. I don’t want the user to edit the blocks’ order, I just want them to edit the content, nothing more. I want the content editor to choose a Template and then the blocks of that template are shown and he can edit them, just like the classic way.

    I saw that you can do something like this where you can register a template and lock the blocks list, but I can’t find a similar way for custom templates.

    So, my questions are these:

    Is there a way to build a custom template with registered blocks and lock them, so when the editor chooses that template, he can only edit the block’s content? What is the recommended way?

    Is there a template hierarchy in Gutenberg themes? What are block-templates and block-templates-parts?

  • You must be logged in to reply to this topic.