Support

Account

Home Forums General Issues How do I embed acf "file" fields

Solving

How do I embed acf "file" fields

  • Please check the code below
    <iframe style=”width: 100%; height: 700px;” src=”https://HCSSC-Report_Dimapur_Nagaland.pdf&#8221; frameborder=”0″></iframe> here in this, I have embedded the pdf file, I have already created a “file” field which will be taking pdf file for one of my field group, so what I want to do is, embed the ACF field, so that I can directly create a custom single file template.

  • Do you just want to put the url of the file field in the iframe? or is it more complicated than that? Not sure what this means

    so that I can directly create a custom single file template

  • Do you just want to put the url of the file field in the iframe? :”YES”

    https://hcssc.in/newsletters/ this archive template I have created by selecting acf fields, (example the title is retrieved from newsletter title field) so I want to show my file fields in same way.

  • Set the file field to return the file URL

    
    <iframe style="width: 100%; height: 700px;" src="<?php 
    the_field('file_field_name'); ?>" frameborder="0"></iframe>
    
  • Hi John, Thanks for the support, please check this video https://www.transfernow.net/dl/20220224HEgIG3AG I have tried with the above code snippet but I didn’t find anything useful, when I give the file field in iframe it’s showing “page not find”, please check this issue,
    Thank you in for your valuable support

  • This reply has been marked as private.
  • Please explain the details here. Sorry, but I’m not going to download a 46 MB video. You can post code and screenshots here if you need to.

  • I was able to view the video.

    You cannot put PHP code in a wysiwyg. You cannot use a shortcode as an attribute of an html tag. In addition to this if you are attempting to use a shortcode then the ACF field must be attached to the same post as the content. If you want to use a file field and insert and iframe in a wysiwyg field then you will probably need to build your own shortcode to do it. Beyond this I’m not 100% sure what you are trying to do, or where the fields are, or how that location relates to the post where you are attempting to insert the iframe.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.