Site logo

Archived topic

ACF File Field as Content Template Dynamic Link

26 replies · Started by Matt on September 26, 2022

Viewing posts 1–15 of 27

Hi Guys,

Just wondering if the following is possible as I'm getting some issues.

I have an ACF 'file' type field setup with return type 'url' (string) setup on my blog posts. As the blog articles have no text or images, (just a title and file upload), I want to allow a user to browse to the main blog archive page, click on a post, and be able to view/download the file that was uploaded without having to go to the post-single page.

I have set up a content template for the post archive layout, and am setting the dynamic link to 'post_meta' on the outer container and then adding my acf field name ('file_download') as the 'meta_field_name'. When I view on the front end the lin is added, but not directed at the url of the uploaded file (eg. http://0.0.6.136/)

Am I doing something wrong here, or is this not the intended use for the dynamic link field on a content template container?

Thanks

Hi Matt,

Can you try using a GB Button to test first?

I get the same result with a button. ie. the same incorrect link is returned.

When I use the acf shortcode in a shortcode field it does return the url to the file. So I do know that the field is setup correctly and returning the right format.

That's odd. That should work. I also tested from my end to be sure.

Can you try recreating the field? Can you try just manually retrieving it through the ACF shortcode through a different Block Element for instance to test. If the issue occurs there as well, it would be best to reach out to ACF.

Sorry can I just clarify. I added a shortcode block to my content template and was able to output the url to the screen.

I have added a link below for your reference. You can see the output of the shortcode above some of the articles, and if you hover over the article you can see the link that is being added to the container.

What are you suggesting I do from here?

Thanks

Can you share temporary login credentials?

Please use the Private Information field for this.

Please see below

Can you make the user an Administrator? We'll check if we find anything which may cause the issue.

Done

Can you try adding it in the Dynamic Data in the Block settings instead?

Don't forget to remove the Dynamic Link currently set in the toolbar.

I have editied the Element per your suggestion but an still seing the same. Below is a link to the one I have just edited.

Can you try recreating the field with a slug name that has no underscore?

Still getting the same result. Are you saying that you have tested elsewhere and get a different result?

Yes, I tested from my end, and an ACF file type - URL is working as a dynamic link. It's weird cause the code in GP/GB only uses get_post_meta(), and it shouldn't cause such an issue.

Can you create a Hook Element, hooked somewhere in your single post pages, and set it to:

<?php

var_dump(get_post_meta(get_the_ID(), 'YOUR-META-SLUG', false) );

?>

Make sure Execute PHP is enabled.

Please see the link below

This archived topic is closed to new replies.