Closed rufus87 closed 2 years ago
Hi there,
Many thanks for your feedback, however it is not visible here.
Seams like you did not understand the issue correctly. The template appears in "Templates" dropdown in any post type, ie: "postTypes" restriction in experimental-theme.json
file does not work. Right now "postTypes" is set to ['page']
, but template is available for selecting in Templates
dropdown when I try to add post
- not page
, as well as the template filename
appears in dropdown instead of the configured title
. There is no difference how template file is named, does it have page-
prefix or not.
Thanks
I can reproduce this as well. For example, if I create a single-product.html
template and then I add:
"customTemplates": [
{
"name": "single-product",
"title": "Product page",
"postTypes": [
"product"
]
}
]
to my theme.json
, the single-product
template is still available in pages and posts. Also, the title
property is ignored and the template is listed as single-product
instead of Product page
.
It seems to be related to this TODO
comment in the code:
I think this was regressed in #30438, specifically in these changes: https://github.com/WordPress/gutenberg/commit/7c134eb66f1e5ed67db646e19234d9edf6e3090e#diff-603069a6df3015f09478e5ed97c90a404f2e17fb29dc7af5467dac8131acc1c6. cc @youknowriad for awareness and in case you think this is something that needs to be prioritized.
Created PR that should fix the customTemplates
title issue - #35592.
I'm working on excluding templates based on "postTypes" PR should be ready shortly.
Description
Custom template configuration in
experimental-theme.json
file does not work neither in default themes nor in custom ones.Step-by-step reproduction instructions
my-custom-template.html
file within current active theme's "block-templates" folderCode snippet
part to active theme'sexperimental-theme.json
fileExpected behaviour
Template
dropdown should not contain above mentionedmy-custom-template
as an option because it should not be available for any post type butpage
.The template title
instead ofmy-custom-template
based onexperimental-theme.json
file configurationActual behaviour
postTypes
restriction does not workmy-custom-template
instead ofThe template title
Screenshots or screen recording (optional)
Code snippet (optional)
WordPress information
Device information