WordPress.org

Support

Support » How-To and Troubleshooting » Need to be able to get the attachment link…

Need to be able to get the attachment link…

  • bluegum

    @bluegum

    With my client’s website I need to be able to get the pdf (attachment) link which has been placed into WordPress via Media, and attached it to a download button per page, this enables the user to download a part of that particular page. Anyway here is one part of what I have started:

    if (is_page('1.5 Tonne Self-Loading Cable Trailer')) {
    				echo '<div class="download">';
    				echo '<a href="http://www.domainname.com/wp-content/uploads/2011/11/1-5-tonne-self-loading-cable-trailer.pdf"><img src="<?php bloginfo('template_url'); ?>/images/downloadbtn.gif" alt="Download the 1.5 Tonne Self-Loading Cable Trailer page as a pdf" width="81" height="31" /></a>';
    				echo '</div>';
    			}

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Many web hosts have removed the mime type for PDF files for security and other reasons (it’s a proprietary format). Consult with your web host first.

    bluegum

    @bluegum

    My web host hasn’t removed the mime types for PDFs. So could someone please tell me how do this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Need to be able to get the attachment link…’ is closed to new replies.
Skip to toolbar