I’m trying to pass an ACF field contents into a tag in a shortcode (in a template) without success.
<Field acf_file=pdf field=url /> returns the URL of a PDF attachment which I want to include in a shortcode as a “Tag in attribute” using braces. The following is not working for me inside a template:
I wish I had enough experience with the ACF integration and shortcode tag to be able to provide a solution here, but I’m not spotting the issue with your syntax.
I figured I’d at least chime in to confirm that this isn’t the issue:
Actually you need to close it:
{Get name=params /}
As noted at the very bottom of this page of the docs, “Closed tags like Field don’t need the slash / to close itself inside an attribute.”
This is a mysterious issue - I wasn’t able to track down why it’s not working, but I added a feature in the Shortcode tag to inspect what attributes are being passed. Could update to the newest plugin version, and try the following?
That should display the PDF’s attachment ID and URL. If both are correct, it means that correct values are being passed to the pdfjs-viewer shortcode. In that case, we might need to dig into the shortcode itself to find out why it’s not working as expected.