Home>Support>Erros CSS Less

Erros CSS Less

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];

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 1 year, 9 months ago Alex S
    Hi, I Work Here

    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

  2. 1 year, 9 months ago Luccas Alves Gaulia

    Perfect,

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More