WordPress.org

Ready to get started?Download WordPress

Forums

Need to be able to get the attachment link... (3 posts)

  1. bluegum
    Member
    Posted 2 years ago #

    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.

  2. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    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.

  3. bluegum
    Member
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.