This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Erros CSS Less

3 years ago · Last reply by Luccas Alves Gaulia 3 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

2
  1. Alex S Staff 3 years, 2 months ago

    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. Luccas Alves Gaulia 3 years, 2 months ago

    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.

Have a different question or issue?

Start New Thread