Site logo

[Resolved] PDF link required

Home Forums Support [Resolved] PDF link required

Home Forums Support PDF link required

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1852327
    David

    Hi everyone,

    I asked this similar question a while ago, and need to come back to it now, so thought a new topic might be best.

    I have created Custom Fields (ACF), and have a field called pdf of type file

    I have tried every way I can think of to make it a link in an element that display the fields, but just can’t make the pdf link work
    (button or text link I’m not fussy)

    If anyone has any thoughts I’d appreciate any feedback…

    Best regards, Dave
    ps – I’ll post on a couple of FB groups too and post back if I get any useful info!

    #1852350
    Elvin
    Staff
    Customer Support

    Hi David,

    Can you link us to a sample page you’re trying to apply this on? Perhaps inspecting it will give us clues as to why it isn’t working.

    Also, can you explain a bit more on how the link should work? Is it a download link?

    Can you also do a var_dump of the ACF to see if it actually has any output? Perhaps its not returning any value. 😀

    #1852351
    David

    Thanks Elvin,
    I will certainly get back to you with those details.
    Dave

    #1852396
    Elvin
    Staff
    Customer Support

    Thanks Elvin,
    I will certainly get back to you with those details.
    Dave

    If you can put up a staging site clone and let us have temporary backend access, we can help you check things out.

    Let us know. 😀

    #1899678
    David

    Sorry for delay, coming back to this…
    Below is the code I used to solve this if anyone else needs similar assistance.
    I used a plugin called XYZ PHP code which creates a shortcode from the added PHP.
    pdf is the name of the field in ACF

    HTH, Dave

    <?php
    $file = get_field('pdf');
    if( $file ): ?>
        <a href="<?php echo $file['url']; ?>"><?php echo("<button class='button'>Download or View PDF Brochure</button>"); ?></a>
    <?php endif; ?>
    
    #1899681
    Elvin
    Staff
    Customer Support

    Nice one. Thanks for sharing it with us. 😀

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.