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

Theme Export: Allow export from wp-admin #39313

Closed
wants to merge 2 commits into from

Conversation

scruffian
Copy link
Contributor

What?

This is a first attempt at part of #27941, to enable theme exporting from wp-admin in Tools > Export

Why?

This is a more logical home for this tool. It also allows us to offer options when exporting themes.

How?

There are several challenges to overcome here:

  1. There's no hook to modify the content on the current Export page - the only tool we have is the export_filters action. The approach here is to output the form at this point in the page, which means we need to do some hacky stuff to add another submit button and hide the one from core. An alternative approach would be to just have theme export live on a different page in the dashboard navigation.
  2. It seems easier to just call the API when the form is submitted rather than calling it in JavaScript, but I'm not sure if this approach might have other implications and cause issues with other plugins
  3. This also changes the zip file name

Testing copying the theme

  1. Go to the site editor and make some edits to your templates and Global Styles.
  2. Open wp-admin/export.php
  3. Select the "A copy of your currently active theme" option
  4. Click the "Download Theme Files" button
  5. Check that the downloaded zip file has the same name as the active theme.
  6. Check that the downloaded zip file contains all the theme files, plus the edits to your templates and Global Styles

Testing exporting only changes

  1. Go to the site editor and make some edits to your templates and Global Styles.
  2. Open wp-admin/export.php
  3. Select the "A copy of your currently active theme" option
  4. Click the "Download Theme Files" button
  5. Check that the downloaded zip file is called themename-edited
  6. Check that the downloaded zip file contains only your templates and theme.json file

Screenshots or screencast

Screenshot 2022-03-09 at 12 58 49

@scruffian scruffian added the [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. label Mar 9, 2022
@scruffian scruffian self-assigned this Mar 9, 2022
@MaggieCabrera
Copy link
Contributor

I like where this is heading! What will happen to the current export menu item in the site editor? Are we keeping that there?

@draganescu
Copy link
Contributor

While the PR is awesome I am not a big fan of adding options on external areas that are part of the workflows which the site editor tries to handle.

This is a more logical home for this tool. It also allows us to offer options when exporting themes.

I don't think the current shape of the block editor which has that top right dot menu as a catch all for so many things is a stable UX. With direction like these we get new affordances whcih will alow new and better ways to offer options, toggles, and general varied UX paths.

In #27941, @mtias mentioned that the UI for exporting should be:

into the main Tools > Export section of the admin instead of a custom flow in the editor and ensure it's extensible like other export tools.

I am not familiar with what kind extensibility this would help with, so there is a blind spot for that, but I would not want to leave this UI where I did all the stuff that led to me wanting to export my masterpiece.

@scruffian
Copy link
Contributor Author

Closing this in favour of #39202

@scruffian scruffian closed this Mar 10, 2022
@scruffian scruffian deleted the update/theme-export-wpadmin branch March 10, 2022 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants