-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Provide a pathway to migrate widgets to block themes #39270
Comments
So I think you should be able to import an existing widget area content into a template part. We should probably place this in the block inspector for a template part as an "import", "use existing widget area" or "transform" action: Considering widget areas can already have block content, this should be a fairly seamless transition. Once it's possible to use and edit template parts on non-block themes (#37943), this flow should be even more transparent. |
It might have been privately with me! 😅 Let me copy and paste some notes that I wrote in July 2021 about this subject: Using CPTs
Pros
Cons
Using widget areas
Pros
Cons
I lean towards the first approach because I feel it fits nicely with block themes and the site editor being a "fresh start" for WordPress that serves as a foundation for the next 15 years of growth. In the year 2030, do we want to be explaining to developers what a "widget" is? :) But, this is all hypothetical. I think we should build a prototype of both approaches and see what happens. |
I like this idea of doing the migration on request as opposed to automatically on theme switch. It's more intentional—less surprises. Also, it caters for users who wish to ditch their existing widget areas and start fresh. |
@noisysocks There are a few issues I see with the "Using CPTs" proposal:
I think @mtias suggestion of importing widget areas on request is far more preferable, and I believe it also mirrors the ability to import menus to the navigation block. That said, the lack of a solution to #31397 could still cause confusion for users about why it's easier to import a "legacy" widget area than to import an inactive template part. No equivalent problem exists for the navigation block because navigations are not tied to themes. #31971 still looks like a workable first step to solving #31397 but was closed due to the PHP code being moved from the experimental plugin into core. |
Yeah, good call on #31397. I think it's another missing piece of the theme switching puzzle. What makes sense to me right now is that both widget areas and template parts to stick around in the database after switching theme and for us to provide:
|
@noisysocks the function for the last part already exists — themes can use |
I'm bumping the priority of this for visibility. |
I just pushed my current progress for this feature #45509. |
What problem does this address?
Currently, when switching from a classic theme to a block theme, widgets created in the classic theme aren't migrated over.
What is your proposed solution?
I could have sworn this was previously discussed, whether on a hallway hangout or in a core editor meeting, but I can't find any related issues so I decided to open this one up since this recently came up as a point of feedback. Since widgets "live" in the spaces that template parts fill, it makes the most sense for migration to happen in the form of generating template parts during migration:
If the user didn't want to use this, they could just ignore or delete the template part. If they switched back to a classic theme, it should preserve backwards compatibility. I don't know enough about the technical underpinnings here either way but wanted to get this documented regardless as it feels like a key area of refinement ahead of more folks adopting block themes in due time.
The text was updated successfully, but these errors were encountered: