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,

3 Answers
3

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>';
    }
}   

Leave a Reply

Your email address will not be published. Required fields are marked *