Use dynamic data in element CSS

I have ACF fields for X/Y position of element. (those are multiple elements in ACF repeater).

How can I use those to style frontend element? I haven’t found the way to insert dynamic data into position settings.

Any ideas?

So far this is only solution > inline CSS with custom attributes:

image

:+1:

Instead of using acf_ … I prefer to use cf_ (which acf_ is just a wrapper for cf_ I think).

Example: {cf_schema_points} (instead of acf_)

If you ever disable ACF, the code will still load.

Same with PHP code…

Instead of ACF’s get_field()

get_post_meta(get_the_ID, ‘your_field’, true);

(this way you can use ACF, but not rely on ACF if it is disabled for debugging etc.)

3 Likes