Archived topic
help with Dynamic Options and ACF
9 replies · Started by Silvano on May 22, 2021
Hi guys!
I need some help here.
I created a CPT that contains the ACF field to upload a pdf file. In the template for this CPT, I created a button to download the pdf file using Button Block and Dynamic Options. However in the frontend, the button links only to the pdf ID instead of the pdf URL.
In the button block I used:
dynamic text type = Post Meta
Meta field name = acf field
dynamic link type = Post meta
Meta field name = acf field
In ACF the returned value is the URL of the file
Hi there,
what type of ACF Field are you using for the PDF download ?
I'm using field File
Does this field work with Dynamic Options?
Currently they don't work with Array Fields - its something we're looking into.
The current workaround would be to create an ACF shortcode to generate the button.
Hi David
thank you for your help.
I tried this but I had another situation ... I put the shortcode button inside a GB Contianer at the bottom of the page, but when rendered, only the A element at the top without a contianer is shown in the frontend. Is the shortcode being rendered before all the content ??
Is it possible to see the page where i can see the problem shortcode?
Hi David
in shortcode I was using "echo" to echo out the button, when I changed it to "return" the button was rendered in the correct location.
So, I believe the case was resolved :)
Thank you for your support.
Glad to hear you found the answer!
Your dynamic button should be looking at the post meta to see that it is an ACF file field then return "Return Value" selected in the ACF field settings.
GPP uses the core get_xxxx_meta functions to retrieve the value. It's not aware of ACF or the field type it specifies.
We're looking at other methods for getting custom meta in future updates. But for now ACF Shortcodes are the way to go.