Loop through all posts, show attachment if there
You can’t use the_title() as you haven’t set up the post data. Instead for the title you need to use: $post->post_title; To get the attachments you can then use get_children() something like this: $args = array( ‘numberposts’ => 1, ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’ ); $attachments = get_children( $args ); foreach($attachments as $attachment) { … Read more