0

I created single-post-type-name.html in templates but they show up like this in the dashboard:

enter image description here

Is there a way to have it like "Single Post Type Name" and also add a description like the Single template that says "The default template for displaying...."?

That single.html does not have any description, so I guess that description is added by default?

https://themes.trac.wordpress.org/browser/twentytwentythree/1.0/templates/single.html?rev=178734

8
  • The filename single is reserved by WordPress to mean a template for any single post or page. Take a look here at the list of reserved name and their hierarchy. You'd be able to get that name to show up by adding the correct template comments as shown here. Let me know if that's what you're looking for and I can post a proper answer to mark as resolved.
    – YourManDan
    Mar 8 at 19:30
  • FYI You'll need a .php file for that to work, rename your file to single-post-type-name.php.
    – YourManDan
    Mar 8 at 19:31
  • 1
    @YourManDan you don't need to rename it, it actually works having it as html. This is a block theme based on TwentyTwentyThree theme I attached.
    – Rain Man
    Mar 8 at 20:42
  • 1
    That description is generated somewhere in WP; not yet possible to add your custom description - github.com/WordPress/gutenberg/issues/44097
    – Will
    Mar 8 at 21:19
  • 1
    @YourManDan Just so you know, all your comments are describing how custom page templates work in classic themes. The question is regarding block theme templates which uses a relatively new system that works completely different to classic themes: developer.wordpress.org/themes/block-themes Mar 9 at 7:12

1 Answer 1

1

To add a readable title to a template, we can add the following to theme.json

"customTemplates": [
        {
            "name": "single-post-type-name",
            "title": "Single Post Type Name"
        },
 ...

But as Will mentioned in the comments, it is not possible to add descriptions yet. There is an issue to track it here: https://github.com/WordPress/gutenberg/issues/44097

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.