-
Notifications
You must be signed in to change notification settings - Fork 54
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
Export patterns #693
Conversation
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* sanitize windows new lines * add tests
There was a problem hiding this 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 ) { |
There was a problem hiding this comment.
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.
* Title: {$pattern->title} | ||
* Slug: {$pattern->slug} | ||
* Categories: {$pattern->categories} | ||
*/ | ||
?> | ||
{$pattern_post->post_content} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 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.
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.