Using ACF Field as an attribute

Not sure if I’m missing something, but I’d like to use an ACF field as a data attribute value.

Intended output would be data-bv=“321” but it is only outputting the name data-bv. The div involved has a basic text element that has the same dynamic field {acf_serving_weight} and that loads in fine.

I’ve tried with the acf field as text as well as number and niether are working. I can get other dynamic fields to work fine, such as the post id, but nothing from my acf field group.

I feel like I’m missing something or just misunderstanding how this would work, but I’ve seen other people using ACF fields in this way.

Thanks!

2 Likes

I’m watching this because I’m sitting with the same issue. Attribute is showing, but attribute data is empty. I’ve even set up ACF using the value : label format. Doesn’t work.

How to reproduce the problem?

It works fine here in Bricks 1.9.9.

CleanShot 2024-07-21 at 1 .11.05@2x

I’m honoured to see that none other than Katakam the WP Legend himself replied!

I found the problem (I think).

The data is inside a query loop, which I did not have activated previously. It seems activating the loop makes the whole thing output correctly.

Thanks, however, for taking the time.

Appreciate it.

Blessings!

Wow! I’m feeling so dumb :wink: I’ve been using query loop for a while, but not this time. And my dynamic data wasn’t working. After searching, I came here, and it feels like Ahhh! Thank you!

1 Like