WordPress adding list of PDF's from Media Library -


I am trying to come up with a way to add a list of PDFs from the Media Library in WordPress. This is for a list of newsletters that will start with the most recent, and there will be about 5 lists. I want to put it in the list with a title and this title should have a hyperlink for the document. So when a visitor clicks the link, he will download the PDF.

I have tried the "get_posts" route but I can not understand it at all. What I am currently doing is placing PDF in a post with a category of "newsletter" and then puts a different loop to draw them on the page. I have almost got this job, but it is not linking properly so I was hoping for some help

My code looks so far:

  & Lt; H3 & gt; Newsletters & lt; / H3 & gt; & Lt; Ul & gt; & Lt ;? Php query_posts ('category_name = newsletter and posts_per_page = 5'); ? & Gt; & Lt ;? Php if (is_posts) while (is_pause ()): the_post (); ? & Gt; & Lt; Li & gt; & Lt; A href = "& lt ;? php echo wp_get_attachment_url (the_ID ()) ;? & gt;" Title = "& lt ;? php echo esc_attr (get_the_title ()) ;? & gt;" Rel = "attachment" & gt; & Lt ;? Php echo esc_attr (get_the_title ()); ? & Gt; & Lt; / A & gt; & Lt; / Li & gt; & Lt ;? Php timeline; ? & Gt; & Lt; / Ul & gt;  

The part I can not find properly is: & lt ;? Php echo wp_get_attachment_url (the_ID ()); ? & Gt;

What I'm currently doing is a "newsletter" insert in PDF A post with category

If you are the only PDF newsletter uploaded in your Media Library, then you can pass this step completely and ask 5 most recent PDFs. ?

  query_posts ('post_mime_type = application / pdf');  

In the problem you are facing, do you attachment to wp_get_attachment_url () , < Post ID.


Comments