Make WordPress Core

Opened 12 months ago

Closed 6 months ago

Last modified 5 months ago

#58827 closed enhancement (fixed)

Publish the Patterns page in the Site Editor to all non-block themes

Reported by: wildworks's profile wildworks Owned by: youknowriad's profile youknowriad
Milestone: 6.5 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch has-testing-info needs-testing
Focuses: Cc:

Description

I based my suggestion on the discussion about the compatibility of the Site Editor and non-block themes in the Gutenberg project: https://github.com/WordPress/gutenberg/issues/52150#issuecomment-1634480850

In the latest Gutenberg (and in WordPress 6.3), the features and pages available in the Site Editor vary from theme to theme as follows:

  • Block Theme: Access to all functions and pages.
  • Classic Theme with block-template-parts support: Template Parts menu appears below the Appearance menu. You can edit the template parts of the theme, but cannot add new ones. You can access the upper Patterns menu to access the new Pattern management features.
  • Classic Theme without block-template-parts support: All functions and pages are not accessible.

In order to make this new Patterns page available to all classic themes, with or without block-template-parts support, I would like to add a Patterns menu under the Appearance menu.

Change History (35)

#1 @wildworks
10 months ago

In the following PR, we were looking for a way to allow all classic themes to access the Pattern page of the Site Editor in the future, while maintaining backward compatibility and preventing possible problems caused by the combination of different WordPres versions and whether or not the Gutenberg plugin is activated.

https://github.com/WordPress/gutenberg/pull/54066

After much discussion, we are considering taking the following approach.

In Core WP 6.4:

  1. Add an Appearance -> Patterns link for all classic themes that point to edit.php?post_type=wp_block.
  2. Allow site-editor.php?path=/patterns access for classic themes internally.

In Gutenberg after the minimum required version is WP 6.4:

  1. Change all "Manage patterns" links to point to site-editor.php?path=/patterns.
  2. Change the Appearance -> Patterns links for classic themes to point to site-editor.php?path=/patterns.

I would like to submit a core patch to accomplish these things.

props: @aaronrobertshaw, @glendaviesnz, @kevin940726, @jameskoster

Last edited 10 months ago by wildworks (previous) (diff)

This ticket was mentioned in PR #5201 on WordPress/wordpress-develop by @wildworks.


10 months ago
#2

  • Keywords has-patch added

Trac ticket:

@wildworks commented on PR #5201:


10 months ago
#3

Please let me know if there are any other considerations or potential issues in order to ship this patch and Gutenberg PR with WordPress 6.4. Should we also ask someone on the core team for feedback?

@aaronrobertshaw commented on PR #5201:


10 months ago
#4

Should we also ask someone on the core team for feedback?

That would be a wise move I think. I'm caught up on other patterns issues/PRs at the moment but will try and organise another review for this one.

Thanks for the nudge 👍

@aaronrobertshaw commented on PR #5201:


10 months ago
#5

Please let me know if there are any other considerations or potential issues in order to ship this patch and https://github.com/WordPress/gutenberg/pull/54066 with WordPress 6.4. Should we also ask someone on the core team for feedback?

I believe this patch is fine and good to go.

The Gutenberg PR though still has an unaddressed issue that I'd flagged previously. The command palette change in that PR needs reverting so that the user is taken to the same location as the links introduced in this patch for classic themes.

@wildworks commented on PR #5201:


10 months ago
#6

Update: The Gutenberg PR that corresponds to this core patch is actually #54422. Sorry for causing confusion.

Once this core patch is applied, the classic theme can access the Site Editor's Patterns page by typing site-editor.php?path=/patterns directly. #54422 fixes unintended behavior in such cases.

#7 @kirasong
10 months ago

  • Milestone changed from Awaiting Review to 6.4

Putting this into the 6.4 milestone per @mikachan's request.

Last edited 10 months ago by kirasong (previous) (diff)

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


10 months ago

#9 @hellofromTonya
10 months ago

  • Component changed from General to Editor
  • Keywords has-testing-info needs-testing added
  • Milestone changed from 6.4 to 6.5

Looking at the linked issue from Gutenberg, that issue is marked as [Type] Enhancement.

Asking in the Make/WordPress slack core channel today, @wildworks noted:

I think this patch (and the Gutenberg's PR) are enhancements and have believed so since the beginning of working on these features.

However, I may have confused this by not changing the Type label to enhancement when I submitted the ticket on Trac.

As this patch/ticket are enhancement, it's too late in the 6.4 cycle, as Beta 1 has already shipped. Per the handbook:

Phase 3: Beta. Betas are released, and beta testers are asked to start reporting bugs. No more commits for new enhancements or feature requests are allowed for the rest of the release.

Moving this to 6.5.

@aaronrobertshaw commented on PR #5201:


10 months ago
#10

Just noting here that this enhancement has been slated for WP 6.5 as it missed the 6.4 beta
(See https://core.trac.wordpress.org/ticket/58827)

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


10 months ago

#12 @rajinsharwar
8 months ago

Hi @wildworks, I tested your patch against the trunk as of today. LGTM on my tests, but there is one thing that I found.

So, suppose I am using a theme that doesn't have the "block-template-parts", for example, Astra. I activated that theme, and in the functions.php, I added: add_theme_support( 'block-template-parts' );

Then, the Template parts menu option was visible. I clicked on that, and it took many seconds to load, and after that the die message: "The theme you are currently using is not compatible with the Site Editor." was shown. After I returned back, I found that there was no more the "template Parts" option on the menu and the code of "add_theme_support( 'block-template-parts' );" was removed from my theme's functions.php.

I am not really sure if this behavior is good, as modifying the theme files without notice isn't something the core should do.

#13 @wildworks
8 months ago

Thank you for the test.

I also enabled the Astra theme and opted in to hoge, but I couldn't reproduce the problem.

  • The Template Parts menu is now under the Appearance menu.
  • Access the Template Parts menu.
  • I saw the All template parts page (this theme has no template parts, so I didn't see anything in the list)
  • I was able to return to the dashboard normally.

This patch only adds one menu (Patterns) and controls access depending on the theme type, but does not modify any theme files.

#14 @hellofromTonya
8 months ago

  • Type changed from defect (bug) to enhancement

As this is adding functionality for classic themes, moving it to an enhancement rather than a bug.

#15 @poena
6 months ago

Does this still need testing? There are positive reviews on the PR on GitHub.

#16 @wildworks
6 months ago

I believe this patch can be shipped, but this PR adds a new menu, so it may be impactful. Therefore, I would be happy to receive feedback from the core team.

@get_dave commented on PR #5201:


6 months ago
#17

👋 Hello team. Whats the update on this feature for WP 6.5? Is it likely to land and if so which features (as originally outlined in the roadmap) will make it. Thanks in advance 🙏

@wildworks commented on PR #5201:


6 months ago
#18

By merging this PR, the following will be achieved in the classic theme as of WP6.5.

  • _Internally_ allows classic themes direct access to the Site Editor's pattern page (/wp-admin/site-editor.php?path=%2Fpatterns)
  • Add a link pointing to the pattern post type list page (/wp-admin/edit.php?post_type=wp_block) under Appearance -> Patterns for classic themes.

More details can be found in this comment.

@aaronrobertshaw commented on PR #5201:


6 months ago
#19

@t-hamano's comment covers nicely what will be delivered via this PR. I believe this should be good to go but we might want a quick sanity check review and approval with fresh eyes before doing so.

#20 @shailu25
6 months ago

Test Report

Patch Tested: https://github.com/WordPress/wordpress-develop/pull/5201

Environment:

WordPress - 6.4.2
OS - Windows
Browser - Chrome
Theme - Twenty Nineteen
PHP - 8.0.18
Active Plugin - None

Actual Results:

  • This patch is adding a 'Patterns' menu. ✅

Screenshot:

#21 @poena
6 months ago

I am testing PR 5201.

WordPress: 6.5-alpha-56966-src
Plugins active: None
Chrome, MacOS
Theme: Twenty Eleven Version: 4.5
Logged in as Administrator

The menu item Appearance > Patterns leads to wp-admin/edit.php?post_type=wp_block and here I can add new patterns, trash, restore, delete, edit, export and import patterns.

Comment: Not for this PR but for the general usability of the feature.

  • The interface for the json import needs some work. The button sizes are not the same and it looks unpolished.
  • I can not find a way to manage pattern categories. I can not see a list of all my pattern categories, edit, delete them etc.
  • When I edit a pattern, the Pattern Categories label input field still says "Add new tag"

Has this been updated? Does the PR need a rebase?


When I manually navigate to wp-admin/site-editor.php?path=%2Fpatterns:
I see the left sidebar panel, and it has two back buttons which feels awkward: The WordPress icon, and the arrow.

In the menu I can choose between:
All patterns, my patterns, my custom pattern category that I just created in the previous step, the category "Twenty Eleven" and uncategorized.
The "Manage all patterns" takes me back to the edit.php?post_type=wp_block, this is correct.

On the right side of the screen, there is a grid of patterns, search field and toggle buttons.
Comment: This feels dated, there may be commits that I am expecting to be added to 6.5 that will update this screen.

Now to the part that felt unexpected:
Has this already been addressed or at least reported?

Each pattern has an an action menu with an option to duplicate the pattern.
This takes me to a screen where the pattern is previewed and there is information about the pattern in the dark grey panel to the left.
I can edit the pattern in two ways: By clicking on the preview, or use the edit button, the pen icon.
Both these options take me to the template editor.

Once I am in the template editor I can suddenly create new template parts by inserting them into the pattern.
I can also see the option that opens the Styles panel.
I can open the styles panel and the stylebook.
I can't add a new color palette because there are JavaScript errors.
I can't change block styles because there are JavaScript errors.
I can export the theme.

#22 @wildworks
6 months ago

@poena Thank you for the test.

I can not find a way to manage pattern categories. I can not see a list of all my pattern categories, edit, delete them etc.

This is a problem that existed before this PR. In the future, if the Site Editor Patterns page can be released to the classic editor as well, it will be possible to edit and delete categories.

When I edit a pattern, the Pattern Categories label input field still says "Add new tag"

This was fixed by [57334]. I've included the latest trunk in the pull request, so this issue should be fixed.

When I manually navigate to wp-admin/site-editor.php?path=%2Fpatterns:
I see the left sidebar panel, and it has two back buttons which feels awkward: The WordPress icon, and the arrow.

Isn't having two back buttons the same for block themes?

Comment: This feels dated, there may be commits that I am expecting to be added to 6.5 that will update this screen.

That's right. Patterns page based on dataview is already stabilized, but WP core does not currently have the latest Gutenberg.

Now to the part that felt unexpected:
Has this already been addressed or at least reported?

The purpose of this PR is only to add a menu and allow site editor access to a specific page. If there is a problem in the Site Editor, We'll need to fix it on Gutenberg's side.

I can also see the option that opens the Styles panel.
I can open the styles panel and the stylebook.

This is not expected behavior either. I would like to submit a PR to fix it on Gutenberg's side immediately.

#23 @wildworks
6 months ago

I have addressed the issues found through testing as follows.

Once I am in the template editor I can suddenly create new template parts by inserting them into the pattern.

I reported it here, but I think this is an existing bug: https://github.com/WordPress/gutenberg/issues/58344

I can also see the option that opens the Styles panel.
I can open the styles panel and the stylebook.

I submitted a PR here: https://github.com/WordPress/gutenberg/pull/58345

I can export the theme.

I submitted a PR here, but I believe this is an existing bug: https://github.com/WordPress/gutenberg/pull/58346

#24 @poena
6 months ago

I think this can be merged. Do the changes made in 58345 and 58346 need to be "cherry picked" into 17.6 RC ...3, 4 ?

#25 @wildworks
6 months ago

Merged 58345 and 58346 are part of Gutenberg plugin version 17.7. This version is the last Gutenberg version included in WP6.5, so I believe no cherry-picking or backports are necessary.

@get_dave commented on PR #5201:


6 months ago
#26

I reached out for clarification on this feature in WP Slack as I've heard different things about what the actual experience will be for users of WP 6.5.

@kebbet commented on PR #5201:


6 months ago
#27

Just the PR. It does not work as expected.

My classic theme uses remove_theme_support( 'core-block-pattern' ) to disable patterns. I therefor expected the menu to be hidden. Now the menu is still visible with core pattern disabled.

@fabiankaegy commented on PR #5201:


6 months ago
#28

@kebbet the theme support you are removing is only removing the core pattern library. It does not prevent users from being able to create pattern using the UI, nor does it remove any patterns added via plugins or themes.

I'm not aware of any method to remove the patterns functionality as a whole.

So I don't think what you are describing is a blocker for merging this at it is unrelated.

I would recommend you create a new issue for adding the ability to disable patterns altogether if that is what you are hoping to accomplish.

@get_dave commented on PR #5201:


6 months ago
#29

@youknowriad Based on x2 approving reviews can we commit this one?

#30 @youknowriad
6 months ago

  • Owner set to youknowriad
  • Resolution set to fixed
  • Status changed from new to closed

In 57543:

Editor: Show the patterns page for classic themes.

Block themes and classic themes with template parts support
can already access the patterns list within the site editor.
This adds a "Patterns" menu item under Appearance for classic themes
without template parts support.

Props wildworks, kevin940726, aaronrobertshaw, fabiankaegy, swissspidy, get_dave, kebbet.
Fixes #58827.

This ticket was mentioned in Slack in #core-test by oglekler. View the logs.


5 months ago

#33 @ugyensupport
5 months ago

Publish the Patterns page in the Site Editor to all non-block themes

Description

I based my suggestion on the discussion about the compatibility of the Site Editor and non-block themes in the Gutenberg project: https://github.com/WordPress/gutenberg/issues/52150#issuecomment-1634480850

Environment

  • WordPress: 6.5-RC1
  • PHP: 8.3.0
  • Server: Apache/2.4.54 (Unix) mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.0.2u mod_wsgi/3.5 Python/2.7.18
  • Database: mysqli (Server: 5.7.39 / Client: mysqlnd 8.3.0)
  • Browser: Chrome 122.0.0.0 (macOS)
  • Theme: Twenty Fifteen 3.6
  • MU-Plugins: None activated
  • Plugins:
    • WordPress Beta Tester 3.5.5

Steps to Reproduce

  1. Block Theme: Access to all functions and pages.

Classic Theme with block-template-parts support: Template Parts menu appears below the Appearance menu. You can edit the template parts of the theme, but cannot add new ones. You can access the upper Patterns menu to access the new Pattern management features.
Classic Theme without block-template-parts support: All functions and pages are not accessible.

  1. 🐞 Bug occurs.

Expected Results

  1. ✅ After Updating WordPress to Version 6.5-RC1 Fixed -'Patterns' menu Added.

#34 @wildworks
5 months ago

Hi @ugyensupport,

Does your comment mean that something is not working as expected in WP6.5 RC1?

#35 @ugyensupport
5 months ago

Yes, I confirm the build works as expected @wildworks

Note: See TracTickets for help on using tickets.