Try/adding pattern previews #88
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR surfaces registered patterns (using
WP_Block_Type_Registry). It leverageswp-themes.comand this screenshot block.Related to: #83
How does It work?
https://wp-themes.com/{theme_slug}?rest_route=/wporg-patterns/v1/patternsfor registered patterns.ScreenShotblock which loads a screenshot of the pattern embedded in the theme viawp-themes.com(See first screenshot)ScreenShot, loads pattern inwp-themes.compreview. (See second screenshot)What's still to do?
Continually improve pattern previews
The screenshot is a snap of a live page, visible at
https://wp-themes.com/{theme_slug}?page_id=2&pattern_name={pattern_name}&preview. I believe this is the best approach because it's the closest experience to what a user would see using the pattern. However, there are some awkward layouts that are somewhat related to the code. So if some patterns are not rendering perfectly, we can make some changes there but that should be iterative. We won't get that correct right away.Improve Theme Page interactions
We could add more affordance to the ScreenShot block for clicking, and better error handling, but I believe that block is currently good enough.
Screenshots
In-theme preview