Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show Attached Image to Post on Wordpress

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

like image 565
fatihturan Avatar asked Nov 29 '09 10:11

fatihturan


2 Answers

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;
like image 187
Adam Dempsey Avatar answered Oct 11 '22 21:10

Adam Dempsey


wp_get_attachment_image

like image 1
Soufiane Hassou Avatar answered Oct 11 '22 21:10

Soufiane Hassou