Replies: 2 comments 1 reply
-
I gave your examples a try and I see the same results. Because it works in the editor it gives the impression it should work on the frontend too. I'm not familiar with the code involved in this so I'm not sure if there's a hard technical limitation or not. Looking into this I found a clue that makes me believe this is not intended to be supported. The Post Template block specifically opts out of support: gutenberg/packages/block-library/src/post-template/block.json Lines 18 to 19 in 7eddee3 I.e. converting a Post Template block to a synced pattern doesn’t work but that’s easily excepted if Post Template is wrapped in a block that doesn't opt out. Even were this intended for support it is probably also an issue that previews of such a pattern are blank. Figuring out what should be done about that seems like no small matter. It looks like you'll probably have to seek alternative solutions. In our other chat you mentioned you already have a block variation for the Query Loop block. I think you could add more features to that variation to have it fulfill your needs though it would obviously be more development effort. As an idea: whether it uses a Swiper slider or not could controlled by a toggle switch and it could reset its inner blocks when the configured post type changes by pulling them from a pattern by a naming convention based on post type. I think that could work and that way your patterns could still be edited via the GUI. There's still the case where it could be inferior to a synced pattern because existing instances of the variation wouldn't take up edits made in a pattern but not sure if that's much of a concern. |
Beta Was this translation helpful? Give feedback.
-
@warudin I'm also in need of this feature - did you ever get this resolved? |
Beta Was this translation helpful? Give feedback.
-
I’ve created a synched pattern per post-type to use as a Post Template-block inside the Query Loop-block.
This seems to work just fine in the editor, it all shows up as I’d expect.
But if I save the page and look to the front-end, something weird is happening.
The configured settings for the Query Loop-block are not passed through to the Post Template-block.
The settings for the post-type, number of posts, offset, everything is reset to the default values.
Per example:
I configured the Query Loop-block to use the post-type “Team”, but it’s showing posts from the default “Post” post-type.
The setting
ITEMS PER PAGE
is also being ignored, the setting fromSettings > Reading > Blog pages show at most
is being used.The same goes for when the Post Template is being added as a template-part instead of a synched patterns.
However, if I “detach” the synched pattern (it reverts to normal blocks), things start to work as intended on the front-end!
Therefore I was wondering: Is it not intended to use the Post Template-block as a synched pattern or template-part?
This is an example of the block structure that I'd like to use for this use case:
This is a screen capture of the difference between the front-end and back-end that I described above:
Naamloos.mov
The Block Structure is like this when the Post Template block is a pattern (
<!-- wp:block {"ref":3808} /-->
).This is the structure for the pattern itself:
Beta Was this translation helpful? Give feedback.
All reactions