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

Site Editor: Export template/parts markup made in the site editor UI to html files #42609

Closed
LukaszJaro opened this issue Jul 21, 2022 · 3 comments
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed

Comments

@LukaszJaro
Copy link

LukaszJaro commented Jul 21, 2022

Frustrating to lose work if you click on clear customization accidently.

Current solution: Copy and paste code from site editor to html files when changes made but is very tedious.

Proposed Solution

Click save:

image

Markup is exported to html file:

image

Drawbacks, will overwrite original template/parts. Maybe a option for DEV mode, which allows overwriting but regular users will keep current workflow and eventually revisions will be available #36060

Or maybe instead of overwriting we can have it like the site editor ui where multiple versions(customizations) are created except in this case would be multiple html files.

@paaljoachim paaljoachim added the [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") label Jul 22, 2022
@carolinan
Copy link
Contributor

carolinan commented Jul 22, 2022

Hi!
I'm sorry but I did not understand the last paragraph.

Did you mean, that you want an option to use the Site Export functionality in the Site editor to only export templates and parts, not the whole theme?

Theme developer handbook: Site Editor export

@LukaszJaro
Copy link
Author

LukaszJaro commented Jul 22, 2022

Hi @carolinan

I want the process to be automated when clicking 'save' and only export the template and template parts to my current working directory. So not exactly the way the site export functionality works, I don't want a zip file created but instead write it to my current working directory i.e., templates or parts.

For example:

function export_templates()
{
	$path =  'mytheme/templates/get-the-current-template.html';
        $data = 'site editor template markup'; i.e., <!-- wp:template-part {"slug":"header","theme":"pii"...

    file_put_contents($path, $data);
}
add_action('save_post', 'export_templates');

@carolinan carolinan added the [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed label Jul 22, 2022
@carolinan
Copy link
Contributor

OK. This was attempted, and you can read about why it was not added here: #39194 (comment)

I will close this as a duplicate of #39194. Further discussion can continue in the original issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed
Projects
None yet
Development

No branches or pull requests

3 participants