Support » Plugins » Display title (and link) to a file in loop / excerpt

  • Paul Wright

    (@signyourbikeout)


    Hello,

    I’m in search of a way to pull any files (other than images) that are added to a post and display the title as a direct link to it in my template file.

    I want to avoid custom fields, because I won’t be the person making the posts.

    Basically, if I attach a PDF to a post, I would like to add a link to that PDF below the excerpt in “posts” page. It would look something like this:

    NEWEST POSTS

    Post Title #1
    Excerpt
    File 1 File 2

    Post Title #2
    Excerpt #2
    File 3 File 4

    etc

    I’m assuming something similar to what I’ve done with automatically grabbing the first image and displaying it as the thumbnail on the posts page. But in this case it would search for files by type and display the link to that file (if any)..instead of the thumbnail of a photo.

    Thanks
    Paul

Viewing 4 replies - 1 through 4 (of 4 total)
  • Paul Wright

    (@signyourbikeout)

    Does anyone have an idea about a solution to this?

    I’d like to be able to find a way to grab all the files attached to a post and provide links to those files in the loop.

    Thanks,
    Paul

    Paul Wright

    (@signyourbikeout)

    I have searched around and there doesn’t seem to be any easy way of grabbing files that are attached to posts and outputting them in the loop as a link.

    The loop can output the post title, the post excerpt and even post thumbnail, but I’d like to be able to include links to any files I attached too.

    Paul

    Michael

    (@alchymyth)

    Forum Moderator

    Paul Wright

    (@signyourbikeout)

    That link is great, and the comments take it even further – thanks very much. I did a fair amount of digging to no avail.

    I haven’t used the code yet, but on first look it does exactly what I want.

    Thanks again

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display title (and link) to a file in loop / excerpt’ is closed to new replies.