WP User Frontend
How can I show title of attachments in posts? (4 posts)

  1. steveone86
    Posted 3 years ago #

    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


  2. professor99
    Posted 3 years ago #

    Maybe I'm missing something but WPUF already includes the option 'Show attachments in the post' that does all of this.


  3. steveone86
    Posted 3 years ago #

    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

  4. professor99
    Posted 3 years ago #

    Alter the code to display $post->post_title

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP User Frontend
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.