-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Element styles are missing in the post template + post content preview #63606
Comments
Today, using WP 6.6.0, I registered style variations for the button block using the partial JSON variation in the styles/buttons/ folder of my block theme. |
I can replicate this issue. Within the Post Template block, any block instance based styles that rely on enqueuing a custom generated stylesheet are missing. This includes both element styles and those for block style variations. From what I can ascertain so far, the issue seems to be that the posts to be displayed within a Query Loop block, and therefore the Post Template block, are retrieved via a REST API call. The response for that API request includes rendered content that has already had filters for Due to these filters having been run, the markup does contain custom element or block style variation class names e.g. I've run out of time to dig further today but I suspect that the current approach to rendering a preview of the post in the PostTemplate block prevents the I'm not very familiar with the PostTemplate block so any suggestions on how best we might fix this are very welcome 🙏 |
With #66003 landing, element styles should now be rendered for the vast majority of cases. There's a contrived edge case where a user may have permissions to edit a given post but somehow not have privileges to see some private content within the post they are editing. In that scenario, the user would still get the old result without styles. That use case is so unlikely, I think we can close this issue out. Eventually we might be able to include style assets along with server side rendered content via the REST API but that is easier said than done. Would you be on board with closing this issue @carolinan? |
Yes, if the problem arises again new issues can be created. |
Description
When a query loop is added in the Site Editor, and the post template block contains a post content block,
the so called "element styles" are missing from the blocks inside the post content.
Step-by-step reproduction instructions
I tested this with a blank theme created with "Create block theme" that has no extra theme styles.
Screenshots, screen recording, code snippet
No response
Environment info
WordPress 6.6-RC4-58723 with and without Gutenberg trunk active.
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
The text was updated successfully, but these errors were encountered: