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

Export patterns #693

Closed

Conversation

eirichmond
Copy link
Contributor

This is a hybrid of @mikachan work, just removed inserter from the header of patterns the they are loaded from the theme, adjusted to heredoc for readability and removed unsynced patterns from the database after saving to the theme.

Copy link
Member

@mikachan mikachan left a comment

Choose a reason for hiding this comment

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

Thanks so much for working on this, @eirichmond!

It looks like this may need a rebase or a fresh merge from #675, I've just merged trunk into that PR so it's up to date. At the moment, it's hard to see which changes are being brought in. However, this is looking great so far 🎉

* and not the database
*/

if ( stripos( $pattern->content, 'pattern-overrides' ) !== true ) {
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a neat way to check if the pattern is not synced. I already mentioned here, but I also found wp_pattern_sync_status in postmeta that we could use as well.

Comment on lines +10 to +15
* Title: {$pattern->title}
* Slug: {$pattern->slug}
* Categories: {$pattern->categories}
*/
?>
{$pattern_post->post_content}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Title: {$pattern->title}
* Slug: {$pattern->slug}
* Categories: {$pattern->categories}
*/
?>
{$pattern_post->post_content}
* Title: {$template->title}
* Slug: {$pattern_slug}
* Categories: {$template->categories}
*/
?>
{$template->post_content}

I think this should use $template rather than $pattern_post - I'm guessing this was accidentally copied over from pattern_from_wp_block. $template->categories might need to be created, too.

@mikachan mikachan deleted the branch WordPress:try/export-patterns September 9, 2024 11:14
@mikachan mikachan closed this Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants