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

Block Templates: Add the custom templates info for the template posts #43597

Merged
merged 1 commit into from
Aug 25, 2022

Conversation

Mamaduka
Copy link
Member

What?

Fixes #43557.

PR updates _build_block_template_result_from_post to include postTypes details defined in theme.json for modified custom templates. Also, add logic to the get_block_templates for skipping these templates when post type argument is provided.

Testing Instructions

Using TT2 theme.

  1. Go to the Site Editor.
  2. Modify the "Page (No Separators)" template.
  3. Open a post.
  4. Confirm "Page (No Separators)" isn't available in Template dropdown.

Screenshots or screencast

CleanShot 2022-08-25 at 11 11 34

@Mamaduka Mamaduka requested a review from spacedmonkey as a code owner August 25, 2022 07:12
@Mamaduka Mamaduka requested review from ntsekouras and Aljullu and removed request for spacedmonkey August 25, 2022 07:12
@Mamaduka Mamaduka self-assigned this Aug 25, 2022
@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] Templates API Related to API powering block template functionality in the Site Editor labels Aug 25, 2022
Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for me and fixes the issue. Thanks for working on it, @Mamaduka!

I'm not sure about the process to merge these things into WP core, should I close my PR because this is going to be merged with the WP 6.1 release or should I update it?

@Mamaduka
Copy link
Member Author

Thanks for testing and reviewing, @Aljullu!

I'm not sure about the process to merge these things into WP core, should I close WordPress/wordpress-develop#3131 because this is going to be merged with the WP 6.1 release or should I update it?

The backporting PHP changes is a manual process, so I would recommend updating your PR 👍

Then leave a comment in #43440, so the Editor release leads are aware of the core patch.

@Mamaduka Mamaduka merged commit 3fdfda3 into trunk Aug 25, 2022
@Mamaduka Mamaduka deleted the fix/template-from-post-post-type-info branch August 25, 2022 13:15
@github-actions github-actions bot added this to the Gutenberg 14.1 milestone Aug 25, 2022
@Aljullu
Copy link
Contributor

Aljullu commented Aug 25, 2022

Thanks for guiding me through the process.

✔️ PR updated: WordPress/wordpress-develop#3131.
✔️ Comment left for the Editor release lead: #43440 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Bug An existing feature does not function as intended
Projects
None yet
2 participants