Issue with ACF select dynamic attribute

Description:

I have an ACF radio that is set to return value “both”. I did this because I would like to give a section a dynamic attribute to apply CSS styles based on the value of the radio field.

Example:

Radio field selected:
received : Application received

<section class="section-c738de cc-sct" status="received">
<span class="acf-radio-style">Content that </span>
</section>

This is the planed CSS:

section[status="received"] .acf-radio-style {
     color: green;
}
section[status="declined"] .acf-radio-style {
     color: red;
}

Unfortunately the dynamic attribute does not work with ACFs that are set to return “Both (Array)”

  • WordPress version: latest
  • Gutenberg Plugin version: -
  • Cwicly Plugin version: latest
  • Cwicly Theme version: latest

The dynamic attribute also does not seem to work inside a Query Template.
I would also like to be able to style elements inside a Query Template based on the value of an ACF.

Hello @Jonas,

Thanks for the report.

Please bear with me.
In this specific case, you want to be able to specify the key (label/value) from the dynamic attribute selector?

Hi @Jonas,

Is this only the case when Frontend Rendering is active?

Thanks in advance.

Hi @Louis,

yes. The Label is for the user while the value should be used as an attribute.

You are correct. This only happens when the query is set to Frontend Rendering. Then the output looks like this:

attribute="{acffield=field_63ea65ec5066a}"

Is there an updaten on this issue?

Hi @Louis,

could you give me some more information on what to expect please? I don’t need an exact time frame but it would be helpful to know if I can expect this to work in the next months or so because this would affect how I build the current project.

This issue also applies to the conditions:

Hello @Jonas,

As this is marked as confirmed, rest assured it will be fixed in the next updates.
Thanks for your patience on this one.

Cheers,

1 Like

Hi @Louis,

perfect! Just wanted to make sure in case there are any technical difficulties that could delay this functionality.

Thanks for the update! :pray:

Hello @Jonas,

This should be addressed in 1.2.9.5.7.
More specifically, attributes for checkbox/radio ACF values should now use value, the same applies to conditions as well.

If you still have trouble or run into specific issues, I’d be grateful if you can let me know by replying to this thread.

Cheers,

1 Like

Hi @Louis,

thank you very much! :pray: Will check it out later.

Hi @Louis,

would it be possible to add the option to chose whether the label or the value should be used for the attribute?
Now I have a situation where I need the Label to use it for the “aria-label” attribute.

@Louis or @Araminta, could you take a second look here?

The reason it would be helpful to also have the option to use the label in the attributes is for example this case:
I have a repeater where my client can fill out their Social Media information. Frist they select the name of the SM platform and then they paste the url to their profile in a url field.

The selection field is set up to return both the value and the label. The value is an icon tag and the label is the name of the SM platform like this:

<i class="icon-facebook"></i> : Facebook

Now when I use this information in my template I use a paragraph that returns the value – so the icon – and attach the url to the paragraph. Now I would like to place a proper aria-label so that people who use screenreaders know what this link does. That’s where the label for the attribute comes in. I would like to give this link the aria-label (Facebook in this case).

Hi @Louis and @Araminta,

hope you don’t mind me asking once again for your opinion on this :slight_smile: