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?
- 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
- Modify upload directory to use post category slug in file path on multisite installation
- How to delete Full Size options from post Add Media?
- Upload images to remote server
- Get first post from wp_query
- Change permalinks for post type ‘post’ only
- wp_insert_post is automatically modifying my post content
- How to limit user to publish post per day and per role?
- How to change post to page
- WP3.5 Media Uploader – how to make it accept multiple images?
- how to enable different number of revisions for different blogs when using WPMU?
- How to enqueue scripts depending on post formats?
- How to add a custom field after wp post
- Submitting POST data to a custom page template triggers a 404, why?
- How to prevent WordPress from updating the modified time?
- Dynamic carousel on individual posts
- Prepend or add an Image to the content of a Post
- Remove all links in post content
- I get this error message when I try to add a module to a course on my website using Sensei plugin
- store posts_id of category into a varable?
- upload_max_filesize in .user.ini Not Reflected in Media Upload
- Multiple comment forms on a single page
- If contributor has published 2 or more posts then show otherwise hide
- How to Assign / Move all Deleted post to a category
- Display a mixed list of posts and media
- Show posts by quarter
- Make ‘blog’ page show content as well as posts underneath it
- Cant’ Grab WordPress Built-in Posts Through Loop
- Sidebar limiting to 10 posts?
- Attachment image single page
- Display content between two dates?
- How to fix wordpress blog post error? Can anyone help to fix this issue?
- Query prints posts without specific categories
- Replicate Media Galley Edit view in Add Media View
- migrate only recent posts
- post categories – how to show only categories with a specific parent id
- Creating a “category” of featured posts
- Post URL duplication adds numerical value
- Is it possible to display QUICK EDIT as default for all posts in wp-admin/edit.php page?
- some posts being displayed as pages
- Body text disappearing in random posts
- Get part of a page url
- Media Library not showing images when adding to Posts (but retrieving image info via ajax)
- Displaying posts on Homepage
- Adding a time stamp on post view
- Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page
- The post order is different for logged-in and non-logged-in users? [closed]
- Display one post randomly from category on home page
- Change a div background color on Post ID
- How to show all Posts Image, Title and 3 line description on main page?
- CSS code for “inserting a custom post divider” after each post
- sub posts to parent post
- How to change Post title background size?
- Load images from CDN and custom features to “Add Media” dialogue
- I am using the query block and what I want and see on the editor page is not the same with the actual results
- Changable favicon based on post-featured image