Attached images in WordPress are handy while using with theme development. Using this code you can get attached images from a page. We are using this code inside a wordpress page templates and we will get its attached images via media option.
<?php $images = get_children("post_parent=".$page_id."&post_type=attachment&post_mime_type=image"); foreach($images as $image) { $url = wp_get_attachment_image_src($image->ID, 'medium'); $caption = $image->ID; echo('<li><img alt="'.$caption.'" src="'.$url[0].'" /></li>' . "n"); } ?>
If you want get attached images of post using id you an use:
<?php get_attached_media( $type, $post_id ) ?>
What is Featured Images & Post Thumbnails
Featured images (also sometimes called Post Thumbnails) are images that represent an individual Post, Page, or Custom Post Type. When you create your Theme, you can output the featured image in a number of different ways, on your archive page, in your header, or above a post, for example.
You can see it in admin area see the screenshot.