Select a block layout from a predefined list of templates in the new WordPress editor.
- Changing an post's template will wipe out existing blocks. This is captured in revisions if you need to revert. I'd like to make that better. :)
- This only applies to the
post
post type right now. I'd like to extend it to work with others. - There is no way to extend templates via PHP yet, but that won't be tough to toss on. See the next section for extending with JavaScript.
I'm open to ideas on how templates should be extended. See src/select-editor-template/extend.js
for how things are currently managed. Any other plugin or theme can use wp.hooks.addFilter()
to register additional templates or remove those added by others.
- This project was originally bootstrapped with Create Guten Block, thanks @MrAhmadAwais!
- When first poking around for solutions, I found WP Gutenberg Templates, which provided some inspiration.