Dynamic content: get attachment file url

Hello,

It’s nice working with “dynamic content” in Cornerstone Pro editor.

Now we are using also to customize buttons to “download” a media element (pdf), so now we are using:
{{dc:post:title post=“67”}}
to get the attachment “title” in the primary text for the button, and also we like to get the file URL like:
/wp-content/uploads/2020/11/example.pdf
but we can’t get it to work.

Something like:
{{dc:post:permalink post=“67”}}
renders the url to the attachment page, but we want to render the url of the file.

We are playing with the “custom meta”, something like:
{{dc:post:meta post=“67” key=“attachment_url”}}
but it does not work.

is there a key we can use, or another option to get it working “the dynamic” way?

Thank you

Hi llribas,

Thanks for reaching out.
If that the key is existed and having data, it will show the output. Only the string data stored in that key can be print using the Dynamic Content. The key you are providing that may not exists or that does not have value.
If you are trying to print the attachment URL of the specific post, the attachment URL method expects an attachment_id as a parameter of it and return an array in the result and one of the elements of which consist of the URL.
You can use the following meta key to get the attached image id and image file path related to that image id.

{{dc:post:meta post="2349" key="_thumbnail_id"}}

{{dc:post:meta post="2510" key="_wp_attached_file"}}

Thanks

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