-
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
Reusable blocks - variables & placeholders #20240
Comments
Hi @christravelblog. Hopefully I've not misunderstood, but It sounds like what you want to do is use the reusable block as a template. If so, there's a way you can achieve that. You could create a reusable block as a template with some content filled out, but other blocks acting as placeholders. You can add that reusable block to your post and then use the 'Convert to Regular Blocks' option to make those blocks editable without having to create multiple variations of your original reusable block: Alternatively, if you're comfortable coding, you could also look at creating a block with a block template inside of it: Is that helpful? |
Hi, BLOCK CONTENT: This is a test block, at [thisplaceholder var1] must go variable 1 that I add in the post itself. I want to be able to change this text, layout in 1 place, in the re-usable block section. At [thisplaceholder var2] must go. It must be blocked as a reusable block in the editor when used in a post. This is a reusable block. When I add this block in the editor I want it to give a drop down in the block where I can fill in var1, var2 which it automatically gets from the [ ] in the reusableblocks. Whent he page is rendered it filles in these 2. It's very basic; and just text is fine enough. If people want advanced stuff they can use ACF. PS> for the moment I have ACF installed; which of course can do this. But for just a few variables and just text, the most basic stuff, I think this can be core? Hope you get my point. |
Yep, I follow the idea. I'll keep this issue open as an enhancement request in that case. I've updated the title to reflect that. |
Thank you. Of course I wouldn't make it to complex in the core. Just simple opiton with text fields. |
Hello, any progress with this feature? It's also useful for me right now. |
I believe this will be possible using the Pattern Overrides feature that will be released in WordPress 6.6, which allows for changing/overriding some aspects of an instance of a pattern without changing the original pattern. That work is/was being tracked in Introduce overrides in synced patterns iteration for WP 6.6, and there will continue to be improvements to the feature in future WordPress versions. |
Hi everyone!
I finally started to use gutenberg ;-)
This can replace quite some plugins I was using in the passed including re-usable content/blocks. BUT, not all reusable content is the same.
I want to be able to pass variables from the post into the reusable block. How do I do that?
For example I have a block containing stuff that goes below the conclusion paragraph. BUT, this contains 3 items that are different for each post but the text is always the same.
So, I want to be able to edit this text/images/whatever from the reusable blocks section. Works. BUT I want to add placementholders there for 3 items. Which I then want to put in the editor of the post. Example, I had reusable block X, and I give it Var1=A, Var2=B, Var3=C and it has to fill that on the placementholders of the block.
Any idea? I would prefer NOT to keep using a plugin for this as I think this could be default wordpress.
Chris.
The text was updated successfully, but these errors were encountered: