• Resolved JTWilcox

    (@jtwilcox)


    Hello,

    I am trying to pull an attachment URL for my posts from the loop.

    More specifically, I am in archive pages, using archives to display each of my categories. Some of my posts will contain links to download PDFs. Back in the archive/category loop, I am pulling the excerpt for each post, but I’m not sure how to get the link to the PDF from within each post and display that below the excerpt.

    I found this post:

    http://wordpress.org/support/topic/referring-to-an-attachment-file-in-the-loop?replies=3

    Which is along the lines of what I need, but it seems to be pulling just the most recent attachment from the media library and including a link to that on every post, rather than pulling the PDF links from within each individual post.

    Any ideas? Thanks.

Viewing 1 replies (of 1 total)
  • Thread Starter JTWilcox

    (@jtwilcox)

    I ended up working through this and getting to something that works for me. Here’s what I’m using:

    http://pastebin.com/are59P17

    This could pose a problem, however, because all it’s really doing is pulling the most recent attachment from the post. So if the attachment is not a PDF, it doesn’t know. And if there is a PDF and then someone attaches an image, it will grab the image.

Viewing 1 replies (of 1 total)
  • The topic ‘Get Post Attachment URLs from the Loop’ is closed to new replies.