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>';
}
}
Related Posts:
- Cannot create new posts or upload images using media manager
- Why does media_handle_sideload upload to last month’s folder?
- What is the proper use of guid for images in wp_posts?
- Does WordPress Super User or Administrators can create and edit post and media on behalf of a user
- Delete Associated Media Upon Page Deletion
- Post slugs and images cannot have same name?
- How to upload post thumbnail while wp_insert_post?
- Download external images if post is publish
- Add metabox with media uploader in a custom post type [duplicate]
- upload featured image from front end using wordpress add media button
- Get post embedded image caption
- How do I programmatically add an image to a post?
- Remove image from post also removes photo from media library
- post_parent is 0 when uploading new files
- How to get future ID for post which haven’t been created yet?
- Too many connections to server
- creating front end image uploader that uploads images as posts
- Insert woocommerce products programmatically with featured image and gallery
- Prevent Delete Attachment by URL or When Submit
- CF7 upload file failing [closed]
- Removal of Media Gallery pictures
- How to get the last selected media alignment setting?
- How to create media library for each user?
- WordPress Automatic Filename Changer
- Redirect to another page using contact form 7? [closed]
- redirect to uploaded (wordpress) post after form submission from front-end
- Uploading images in custom post form
- Upload attachment from external site
- download button for audio file in post [closed]
- How to call WordPress First Image Post or else Attached Image or Default
- All images on one line for each post
- How can I to add upload functionality outside of the admin area?
- unable to write to the database while uploading images
- Get post attachment with post id
- Post images are not displayed in media library
- Schedule image post on download
- Allow users to post their videos to my wordpress website?
- how to create other sizes of original image in one go wordpress uploads
- Update all images url imported from HTML pages
- Disable Media uploader to users
- How to get only current images of a post
- WordPress Media URLs?
- Inserting image into post content – Front End
- Get attachment if matches a variable
- Inserting Media on New Post But Hides Previous Uploads for Editor/Contributor
- WordPress portfolio posts: media not displaying if several images
- Xhr.send : PDF upload failed with status 400 and response 0
- Modify upload directory to use post category slug in file path on multisite installation
- How to delete Full Size options from post Add Media?
- Get WordPress post content by post id
- How to Protect Uploads, if User is not Logged In?
- Get page ID of page that is set as the posts page
- Get Posts Under Custom Taxonomy
- How to limit the number of posts that WP_Query gets?
- Stop WordPress Wrapping Images In A “P” Tag
- When is the ‘post_content_filtered’ column in database cleared by WordPress?
- Turn a URL into an Attachment / Post ID
- GET the excerpt by ID
- Stop WordPress automatically adding tags to post content
- How to Fix HTTP Error When Uploading Images?
- Determine if page is the Posts Page
- How to get ‘post_content’ without stripping tags?
- How to add an admin notice upon post save/update
- Trigger refresh for new media manager in 3.5
- Print Current Post Index number within Loop
- Should we trust the post globals?
- Physical organization of wordpress media library (Real Media Library plugin)
- Optimize post insert and delete for bulk operations?
- Get the Current Page Number
- How do you add thumbnail support for custom post types?
- Extend Media Library
- How to mark every 3rd post
- Change Posts per page count
- Keep featured content post in homepage with original order
- Upload Multiple Files With media_handle_upload
- How to display related posts from same category?
- Can posts have parents?
- Is there a action hook for the “Empty Trash” button?
- WordPress 3.5: Setting custom “full URL path to files” in the Media Library?
- How to end the excerpt with a sentence rather than a word?
- How do I check if I linked to a post before I delete it?
- How to change the case of all post titles to “Title Case”
- Appending content with broken in 4.4
- How to get posts published between a date and today?
- ZIP up all images displayed in a [gallery] and offer as download link
- How to detect single.php (but not single-portfolio.php)?
- How to check if post meta key exists or not in wordpress database
- How to remove a column from the Posts page
- Submit post and upload image from front-end
- Upload images to remote server
- removing inline styles from wp-caption div
- What is the use of to_ping and pinged column?
- How to use “Add link” pop up for a WordPress widget
- Remove Categories / Tags From Admin Menu
- How to retrieve text only from wp_content() not from wp_excerpt()?
- Stop WP from creating “Sample Page” and “Hello World!” post
- Where is the old post permalink slug stored?
- How to Create Editable Blocks of Text for the Homepage?
- Keyboard shortcut for updating a page or post?
- Add custom Attachment Display Setting for images