Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have Press Release Section on my page where i would like to be able to add documents pdf, ms doc's etc. Every time when i add new document to a post I would like download button to appear so user will be able to download that document. Could anyone point me at right direction or maybe there is a plugin existing which does that.

Many thanks,

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

No need to insert the download into the post as @kaiser says, you can automate:

$download = get_children( 'post_type=attachment&post_mime_type=application/pdf&post_parent='.$post->ID );

if ($download) {
    foreach ( $download as $attachment_id => $attachment ) {
        echo '<a href="'.wp_get_attachment_url($attachment_id).'" target="_blank" class="download">Download PDF</a>';
    }
}   
share|improve this answer
    
I think that is what I'm looking for I will try that thanks –  jmysona Jun 15 '11 at 17:21
    
It worked thanks. –  jmysona Jun 15 '11 at 23:17
add comment

enter image description here

enter image description here

enter image description here

When you insert a file into a post/page/whatever, you get a <a>-download link.

enter image description here

Then you can style this link as you want. Just insert the styles you need into your style.css file.

share|improve this answer
add comment

there are a few plugins out there but the one that stands out is WordPress Download Monitor which works great and has many many features, one of them is creating a download button template for easy styling as a shortcode for even easier page/post insertion.

share|improve this answer
    
Yeah thats a nice plugin, well designed. –  addedlovely Jun 15 '11 at 16:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.