File download button using Advanced Custom Fields

Hello there,

How do I attach a downloadable file to a Cornerstone button using an ACF field? Please see the attached images.

We are building a grid displaying a custom post type - each post will have a button with a downloadable file attached.

I am using a download file custom field in a custom post type and have added the field group key to the Link URL field in the button settings:

{{dc:acf:post_field field="group_64b15a3e75e8a"}}

However, the button links to the post itself and not the file. Do you know what I am missing?

Kind Regards,

Spencer

Hello Spencer,

Thanks for the detailed information. The Button element is linked to the post itself because the “Post” element container is linked to the post item. To make the button work, you will need to change the HTML tag of the “Post” element from <a> to a <div> instead.

Best Regards.

Hi @ruenel,

Thanks for getting back to me. I have changed the post element to

but the element is still set to . I have cleared the system cache, so what have I missed?

1. post element 2. a-div

Thanks!

Spencer

Hey Spencer,

Suppose you are referring to this page: https://btwhole.sale/new-tools/. It is not using a layout archive but a Cornerstone page, please see the secure note for the backend page link. I changed the <a> to a div. Then in your added this dynamic content as your button URL {{dc:acf:post_field field="download_file"}}, I also added a custom attribute in the button to make it downloadable when clicking the button.

image

Hope that helps.

1 Like

Hi @marc_a,

Thanks for getting back. That is a great help, thank you!

Cheers,

Spencer

Hey Spencer,

You’re most welcome!

Cheers!

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