Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template Types in patterns not working #58223

Closed
bgardner opened this issue Jan 24, 2024 · 8 comments · Fixed by #58813
Closed

Template Types in patterns not working #58223

bgardner opened this issue Jan 24, 2024 · 8 comments · Fixed by #58813
Assignees
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release

Comments

@bgardner
Copy link

bgardner commented Jan 24, 2024

Description

Using the following code in my patterns to make certain patterns available for creation of templates:

<?php
/**
 * Title: Post content with gradient cover
 * Slug: powder/template-single-gradient-cover
 * Categories: powder-template
 * Template Types: single
 */
?>

With WordPress 6.4.2, here is a screenshot taken after following the steps below:

image

With WordPress 6.4.2 and Gutenberg 17.6.0 RC1 active, here is a screenshot taken after following the steps below:

image

I have two patterns in my theme which use * Template Types: single.

Step-by-step reproduction instructions

  1. Go to Editor > Templates > Add New Template > Single item: Post
  2. Select All Posts
  3. See available templates.

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 6.4.2
Gutenberg 17.6.0 RC1

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@bgardner bgardner added the [Type] Bug An existing feature does not function as intended label Jan 24, 2024
@bgardner
Copy link
Author

I can also replicate this issue with the TT4 default theme.

@bgardner
Copy link
Author

Also worth noting, this issue does NOT exist with Gutenberg 17.5.2 active:

image

@annezazu annezazu added [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Regression Related to a regression in the latest release labels Jan 25, 2024
@colorful-tones
Copy link
Member

colorful-tones commented Feb 1, 2024

I'm sleuthing on this now to see where code was introduced to cause this regression.

Steps for testing and verifying:

  1. Open Site Editor > Templates > Add New Template: 'Single item: Post' > All Posts
  2. The 'Choose a Pattern' modal should pop up and with TT4 activated there should be two patterns available.
Before After (w/ regression)
Screenshot 2024-02-01 at 12 22 17 PM Screenshot 2024-02-01 at 12 23 30 PM

@colorful-tones
Copy link
Member

Something was introduced in #57999 that caused this regression. Maybe @ellatrix might have some insight. I'm now peeking at the code that was altered in the PR.

@colorful-tones
Copy link
Member

colorful-tones commented Feb 1, 2024

I suspect that one of the two patterns in our testing scenario comes from the WP core and not the Twenty Twenty-Four theme. There is only one pattern in the Twenty Twenty-Four theme that has a single template target Template Types: posts, single in twentytwentyfour/patterns/template-single-portfolio.php. The other pattern is probably not a pattern per se, and likely showing the twentytwentyfour/templates/single.html?

@ellatrix
Copy link
Member

ellatrix commented Feb 8, 2024

Does this fix the problem by any chance? #58661

@ellatrix
Copy link
Member

ellatrix commented Feb 8, 2024

Thanks for providing minimal steps to reproduce. I indeed see two patterns for 17.5 but online 1 in trunk and even with that branch. I'll investigate further.

@colorful-tones
Copy link
Member

Thanks @ellatrix for digging in. I meant to dig on the code but did not make it that far. I’m happy to test any follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants