• Hey everyone, I was wondering if i can get some help with this issue im having. I am currently using the code provided by the author(Patrik) to show attachments in posts which is

    $args = array(
        'post_type' => 'attachment',
        'numberposts' => null,
        'post_status' => null,
        'post_parent' => $post->ID
    $attachments = get_posts($args);
    if ($attachments) {
        foreach ($attachments as $attachment) {
            echo wp_get_attachment_image($attachment->ID, 'medium');

    How can I show the title of the attachment? Can I show it under the attachment?

    Thanks for the help. Would appreciate any advice


Viewing 3 replies - 1 through 3 (of 3 total)
  • Maybe I’m missing something but WPUF already includes the option ‘Show attachments in the post’ that does all of this.


    Hello Professor,

    Yes it does do that but I am using the manual code so the attachments can appear in the actual post. The title of the attachments are not displayed when i insert that code

    Alter the code to display $post->post_title

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How can I show title of attachments in posts?’ is closed to new replies.