• Hi. I would really like to be able to have reusable blocks with slots that can be defined different on each instance. What I am looking for is something like Vue slots.

    I can’t find a documented way to do it. It seems that the closest thing I can find are block variations.

    Any ideas on how I may be able to achieve this behavior?

    • This topic was modified 2 years, 5 months ago by Jan Dembowski.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey @visionm,

    What exactly are you trying to do? Can you explain with an example? Thank you!

    Thread Starter visionm

    (@visionm)

    So in my case I am working on a trilingual site… So right now I have I separate page for every language but I would like to share the components of each page. Right now since the inner content of each component on each page is different I cannot use a Reusable Block or a template part. So Whenever I want to make a minor change to the component I have to do the same for each page for each translation.

    … Now that I am writing this I am thinking that there could be a better plugin that for managing translations than the one that I am using that would be able to handle this just fine and that would be great if there was but thats not exactly the point.

    In Vue you have components and in those components you can have slots where you can put simple things like text but you can also slot in other components. In this way you are able to change one thing or the other in one place and the change will be reflected amongst all of the instances of the component independent of the “child/parent” relationship of each component.

    This is one of the things that gives Vue its power and would be great to see something similar in WordPress seeing how (or at least from what I have seen). the block editor is leaning heavily on React, which I have not studied but also, in one way or another, has this type of functionality.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Slots in Reusable Block’ is closed to new replies.