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

Feature: Block-based template parts for Classic themes #3258

Closed

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Sep 15, 2022

Fork of @Mamaduka's #3234, to apply this small fix.

Quoting that PR's description:

Testing Instructions

Classic theme - TT1

  • The new "Template Parts" menu shouldn't appear in Appearance.
  • Users can't access the /wp-admin/site-editor.php path directly.

Block theme - TT2

  • The new "Template Parts" menu shouldn't appear in Appearance.
  • The "Editor" menu is accessible.
  • The Site Editor works as before.

Themes with block-based templates part enabled You can grab the testing theme from this repo - https://github.com/Mamaduka/block-fragments

  • The new "Template Parts" menu is visible under Appearance.
  • The menu redirects to the "Template Parts" list view.
  • The "Site" and "Templates" navigation items aren't visible.

Warning
The last item will require the latest package update PR to be merged, and it might not be possible to test immediately.

For any other details, please see the original PR.

(@Mamaduka is AFK and gave me permission to fork his PR via DM.)

Gutenberg tracking issue: WordPress/gutenberg#43440
Trac ticket: https://core.trac.wordpress.org/ticket/56467


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Mamaduka and others added 4 commits September 15, 2022 11:52
non block themes that support block based template parts should only be allowed to access the site-editor.php file if the query parameter to access the template part editor is set correctly
@ockham
Copy link
Contributor Author

ockham commented Sep 15, 2022

@fabiankaegy Would you mind approving this PR? 😊

Copy link
Member

@fabiankaegy fabiankaegy left a comment

Choose a reason for hiding this comment

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

Thanks for updating the PR 🚀

@fabiankaegy
Copy link
Member

@fabiankaegy Would you mind approving this PR? 😊

I'm not sure whether I have sufficient access to actually approve it. But from my perspective this is ready to go :)

@hellofromtonya hellofromtonya self-assigned this Sep 15, 2022
@hellofromtonya
Copy link
Contributor

Retested per my Test Report. Confirmed @fabiankaegy resolves the white screen issue of attempting to access /wp-admin/site-editor.php

Testing Report

Env:

  • WordPress: trunk
  • Plugins: none
  • Browser: Firefox
  • Localhost: wp-env

Results:

Classic theme - TT1, TT0

  • The new "Template Parts" menu shouldn't appear in Appearance ✅
  • Users can't access the /wp-admin/site-editor.php path directly ✅

Screen Shot 2022-09-14 at 11 55 15 AM

Block theme - TT2, Frost

  • The new "Template Parts" menu shouldn't appear in Appearance ✅
  • The "Editor" menu is accessible ✅
  • The Site Editor works as before ✅

Themes with block-based templates part enabled
Theme: https://github.com/Mamaduka/block-fragments

  • The new "Template Parts" menu is visible under Appearance ✅
  • The menu redirects to the "Template Parts" list view ✅
  • The "Site" and "Templates" navigation items aren't visible ❌ (needs the JS packages updated - per notes in the description)

Screen Shot 2022-09-14 at 11 52 36 AM

Observations:

With the block-fragments (classic theme with block-based templates) enabled, I am able to directly access /wp-admin/site-editor.php but it's a white screen. No errors in the browser's console or error logs.

Fixed ✅ Now when attempting to go directly to /wp-admin/site-editor.php, the user gets an error as expected:

The theme you are currently using is not compatible with the Site Editor.

Copy link
Contributor

@hellofromtonya hellofromtonya left a comment

Choose a reason for hiding this comment

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

  • The PR works as expected, minus the one test point that is dependent upon package updates (i.e. which will be retested once updates are backported).
  • The PR meets Core's coding standards.

Prepping the commit

Observation:
There are a few optimizations to explore, e.g. instead of invoking current_theme_supports() et al repeatedly within the same file. However these are out-of-scope for this PR.

@hellofromtonya
Copy link
Contributor

Thank you everyone for your contributions! Committed via https://core.trac.wordpress.org/ticket/56467.

@ockham ockham deleted the backport/site-editor-template-parts-mode branch September 15, 2022 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

4 participants