How to Add Uploaded Media to WP-DownloadManager
I think this is a good time to spell out the configuration of my site (you can skip this page if you just want the code, but do it at your own risk – my configuration is different from the default):
All of our clinic forms are sub-pages of a page called “Forms”. Each of the “form pages” uses a custom built WordPress Template called “Forms”. Each of the form pages points to a file that was uploaded to our local server – it was not uploaded through the media library (making this work with the Media Library is possible, I found, but messy – if you need it done, and we’re talking about having more than 1,000 media files, leave a comment and I’ll post an update).
Since the pdf’s and doc’s are not “attached” like media uploaded via the Media Library, each page has a custom field called “FileName” and the value of the custom field is simply the filename, like “0423_employee_handbook.pdf”. The “Forms template” then points to the directory where the forms are stored (./wp-content/forms/) and the custom field adds the file name to complete the download url.
All of the download managers for WordPress put the title and filename of the download into a MySQL table. Since all of my forms have a custom field called “FileName”, I simply need to create a list of those posts. Then I needed to find the values stored in the custom field called “FileName” that links each form page to the download-able form.
Let’s translate all of that to MySQL terminology:
Related posts:
- Search and Replace a Custom Field in WordPress using PHPMyAdmin
- Search and Replace MySQL using PHPMyAdmin
- How to Bulk Import into a MySQL Database
- Delete Comment Spam using a Cron Job
- Allowing Uploads via the Media Uploader
Comments
2 Responses to “How to Add Uploaded Media to WP-DownloadManager”
Thank for Information
Hi, cool post. I have been wondering about this topic,so thanks for writing.