Show Images from Post or Page Attachments

Get all image attachments from a page or post. I usually use this to show a slideshow on a page.

I also put how to get the title of the attachment (but I commented it). You can customize how the image will show.

Code Snippet:

<?php
$argsThumb = array(
	'order'          => 'ASC',
	'post_type'      => 'attachment',
	'post_parent'    => $post->ID,
	'post_mime_type' => 'image',
	'post_status'    => null
);
$attachments = get_posts($argsThumb);
if ($attachments) {
	foreach ($attachments as $attachment) {
		//echo apply_filters('the_title', $attachment->post_title);
		echo '<img src="'.wp_get_attachment_url($attachment->ID, 'thumbnail', false, false).'" />';
	}
}
?>

Posted in Images, Pages, Custom Fields