ACF Field within Stylesheet

Hey folks,

Sorry if this has been asked, but I did some searching and could not find an answer, so here I am .

I am wondering if there is a way to call an ACF within the stylesheet?

What I am trying to achieve is the ability to change a background image that is used within a section. I have created the field in ACF, then user then can change that background image within the field UI on that page.

But when I try to have that function dynamic I cannot seem to get it to work. Yes, I have used the “Assets” feature within L&L and that works great, however it is not dynamic (unless I am doing something wrong).

Does anybody know a way or any idea how to achieve it?

Many thanks

Hi Mike! You’ll want to check out Sass variables. You can save your ACF field as a variable and then refer to it in the style tab the same way you’d normally refer to a variable in Sass, like $variable_name. Hope that helps!

1 Like

Perfect, thanks Benjamin I will give that a go this morning. =)

1 Like