Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].
I’m not able to put the Image URL in the Background to work with the Background CSS
widget.php
function get_less_variables( $instance ) { $odometer_background = $instance['odometer_background']; ...
default.less
@odometer_background_img: default; background: url(@odometer_background_img) center center no-repeat; ...
It only works if you put it in style=””
default.php
$odometer_background_img = siteorigin_widgets_get_attachment_image_src( $odometer_background_img, 'full' )[0];
Hi Luccas,
Thanks for reaching out. This is a known technical limitation with variables and the recommended solution is to add the image using inline CSS – the solution you mentioned at the bottom of your post. This doesn’t appear to be documented in our developer docs and I’ll rectify that shortly.
Kind regards,
Alex
Perfect,