Show Attached Image to Post on WordPress

How i can show attached images of my posts on WordPress?

Related posts

Leave a Reply

2 comments

  1. Try this in your single.php template:

    $args = array(
    'post_type' => 'attachment',
    'post_mime_type' => 'image',
    'post_parent' => $post->ID
    );
    $images = get_posts( $args );
    foreach($images as $image):
    echo wp_get_attachment_image($image->ID, 'medium');
    endforeach;