How to place an ACF background image?

How can I place an ACF background image?
I Have this code, but it doesn’t work

<div class="single testimonial" style="background: url({Field acf_image=background /})">

Hi Frans! ACF lets you choose to store images in image fields as an image array (default), URL, or media ID.

Since you’ve probably got the default behavior on, you’ll need to pass an additional attribute to your acf_image field to indicate what information you’re trying to retrieve. The possible values are documented in the fields section of the attachment loop docs. Here’s what your div tag should look like (extra spacing added purely for readability):

<div 
  class="single testimonial" 
  style="background: url({Field acf_image=background field=url /})"
>

ACF image field documentation can be found here:

1 Like

Hi Julia,

Thanks again!
(Sorry for my late reply. For some reason I don’t receive the notifications)

1 Like