WordPress block template documention

Templates are used for a particular view of the WordPress (WP) site, for example the home page, search results, a single post or a page. They’re called things like index.html, page.html and archives.html. Their contents are mysterious: I cannot find anything other than a brief section on manually creating templates in WP’s documentation.

The only documentation I can find on creating templates manually is not exactly the best. The Block Editor Handbook actually says:

If you are not sure what the correct block markup is, you can add the block in the block editor and copy the block markup from the code editor mode to your theme files.

WordPress Create a block theme

The documentation on Templates and template parts in the Theme Handbook says pretty much the same thing:

To get the code for the blocks and block settings, you can add the blocks in the editor and then copy the code from the block toolbar options menu. Paste the code into your template.

WordPress How to find which block to use in Templates and template parts

Later, in the same document, there is a section about creating templates with code, which helpfully says:

Create a new HTML file for each template and place them inside the templates folder in your theme.

Add the markup for the blocks you want to display.

WordPress How to create templates with code in Templates and template parts

It seems to me that WP have no (public) documentation on their template markup, but would prefer you to use their Site Editor.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.