-
honzapecenka
In Generateblocks v1, it was possible to set a background container and a dynamic image based on the featured image.
How do I set this up in GB v2? -
Alvind
Hi there,
In V2, you can use the Featured Image dynamic tag and set it in the Inline Background Image field:

-
honzapecenka
Hi Alvin,
I don’t have this option there because the container is not a div, but an a tag.
https://prnt.sc/UHSeKMsyes4n
The image is set via Styles – Background.
https://prnt.sc/inbOlv2Dwz1x -
Alvind
Okay, I looked back at your structure, and you don’t need to add that extra container for the background image. You can use the Loop Item block itself to set the background image—if the block is set to a tag, the Inline Background Image option is still available.
The image set under Styles – Background is fine—no changes needed. The
var(--inline-background-image)will pull the dynamic image set in the Settings panel. -
honzapecenka
When I move the background to item-loop, scale won’t work on hover—it will enlarge outside the container.
I don’t quite understand whether to leave the container with the background. Or set the fixed default image as the background on item-loop?
-
I don’t quite understand whether to leave the container with the background. Or set the fixed default image as the background on item-loop?
I don’t quite understand what you mean, can you explain some more?
-
honzapecenka
Hi Ying, I responded to Alvind because I didn’t understand.
I asked how to set the default featured image in the existing structure when it is not filled in for the post. In GenerateBlocks v1, it was very easy. I cannot move the dynamic background image to the loop item because then the hover scale will not work—it will overflow the loop item container. -
I see, it’s simply in v2 as well.
You can add another background image in the backgrounds panel, under the dynamic background image, and choose a static image, it will show when there’s no featured image.
https://app.screencast.com/mPN9czeRb6SWT -
honzapecenka
I’ve already tried that, but the fallback image doesn’t show up. Posts that don’t have a featured image set will appear white, and the link doesn’t work either.
-
Can you check the dynamic image setting? Did you check the Required to render option?
If so, uncheck it, let me know if this helps!
https://app.screencast.com/FxWehzqyEqFkW -
honzapecenka
In Style, I only see var(–inline-bg-image) for the background. There is no checkbox here.
I had to switch the label name from a to div and reinsert the featured image. I unchecked the Required to render option checkbox. I switched the label name to a.
I see a white background in the editor, but it’s OK in the frontend. Is it ok?
But yes, it helped. 🙂
-
Yes, the editor is trying to load the featured image in the editor, but on the front end, it should be ok 🙂
Glad you’ve got it working!
-
honzapecenka
Thank you very much for your help. You´re best. 🙂
-
You are welcome 🙂
- You must be logged in to reply to this topic.