I am utilizing WordPress 6.0 and I’ve created a toddler theme from TwentyTwentyTwo. I’ve created a customized put up kind utilizing code like this:
register_post_type('foobar', [
'public' => true,
'show_in_rest' => true, // enable block editor
// etc
]);
In my baby theme, I’ve created the listing templates
, and inside it, a file named foobar.html
. I’ve copied the contents of single.html
from twentytwentytwo/templates/
to this folder and renamed it to foobar.html
to make it match the customized put up kind.
If I open the location editor, and click on “Templates”, I see these templates listed:
- Single Publish
- Web page
- foobar
- Dwelling
- Search
- and so forth…
Nevertheless, once I create a brand new put up of the customized put up kind foobar
utilizing the WordPress admin interface, the default template is “Default template”, and never “foobar”. How do I modify the default block template for a customized block kind?