Using dynamic content with javascript in layout

Good afternoon folks! I hope you’re having a great day. Just a quick question that I’m sure will be obvious to some of you, but I haven’t figured it out. I am creating a layout and am incorporating some ACF fields. I have written a javascript function within the “Single layout JS” code editor. How can I use dynamic content within this? I thought I would simply be able to do something like this;

var foo = ‘{{dc:acf:post_field field=“coordinates”}}’;

However, it doesn’t look like the actual value is being rendered. In the console it’s simply showing up as the text {{dc:acf:post_field field=“map_coordinates”}}. If I don’t wrap the DC in single quotes, I get the error Uncaught SyntaxError: Unexpected token ‘{’.

Can you give me a pointer please?

Thank you so much.

@pmason

I have the same issue :slight_smile:
Dynamic content in single layout JS

best regards
Mirco

Hello @pmason,

Thanks for writing to us.

I tested it on my end and replicated the issue. I suspect it might be a bug of the latest release I went ahead and reported it to our development team. I would request you, please stay tuned for succeeding theme updates.

Thanks for understanding

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.