Query loop pdf files for downloading

Hi, I made a query look with post type set to media and the mime type to application/pdf. After that I can use post_title to get the name, however the post_url points to the post instead of the pdf itself.

I want to retrieve the url of the pdf (attachment) not the media post, any suggest?

Thanks Max

@maxi did you ever find the solution to this? I need to do the same, but I’m also trying to find a way to dynamically display the thumbnail of the pdf from the media field. The thumbnail is displayed if you select a static file, but not if you use the media id dynamically.

@timmse or @thomas any thoughts on how to accomplish this? Thanks!

NM on the thumbnail, I found the issue on my site.

Hi guys,
You can probably use these native WordPress functions alongside echo (untested):

Mind elaborating on that PDF thumbnail solution? I’ve tried a couple of things but nothing’s worked. I can see the thumbnails in the Media Library, but nothing I put into the Dynamic Data field will go and fetch that thumbnail.

Thanks!

I have done that with a CPT and an ACF image field, which i misuse for PDFs. I‘ll redo it in Bricks soon and can share my findings.