Blocks Attribute

Hello,

I am trying to add a Block Attribute for a background image. I have added a Block Attribute to the same ‘level’ as the registered block. I have had no issue adding block attributes with content editable fields for text inside the block. See screenshots.
If I select within the Block Attribute ‘Use as’ - ‘Background image’ no matter what I select for ‘Control Type’ the block crashes within Wordpress telling me my block no longer exists.

Now I can ‘Use as’ - ‘style’ and target by class for the image to be inserted inline. But I would much rather do so through CSS. Is there no way to do so with Blocks? I would appreciate any help.

Also, is it possible to replace the Wordpress colours with my custom colours, or most I hardcode that?
Background image paths within Pinegrow can be unpredictable when exporting to a Wordpress theme, especially with Sass. I built a CSS Grid hover gallery and the img src had correct paths but href’s links I wrapped them in did not, once exported as a theme.



Thanks @deirdre_nic, I found and fixed a bug with Bck image attributes on the top element of a dynamic PHP block. The update will be out today or tomorrow.

A workaround is to add an inner wrapper element and add the Bck image attribute there.

WP colors can’t be changed with PG at the moment. You could add a custom theme.json to the theme to do that.

I did figure out that work around. Thank you for fixing that bug :grinning:
I don’t know if you have noticed the bg image issues in SASS as well. The paths deviate. Especially when you turn it into a WP theme. I will use the visual interface to select a background image, place the inline bg image in a SASS file all through the interface (and I have hardcoded it as well). Thats when the paths to that image comes in conflict with Wordpress.

Yes, that’s a known issue. One workaround is to have two copies of the image: one in the original location and the second copy in the location where compiled CSS is looking for it.

Ah I see, thank you.