Return to Snippet

Revision: 21331
at December 10, 2009 14:42 by fatihturan


Initial Code
<?php function postimage($size=thumbnail, $qty=-1) {
	if ( $images = get_children(array(
		'post_parent' => get_the_ID(),
		'post_type' => 'attachment',
		'numberposts' => $qty,
		'post_mime_type' => 'image',)))
	{
		foreach( $images as $image ) {
			$attachmenturl=wp_get_attachment_url($image->ID);
			$attachmentimage=wp_get_attachment_image( $image->ID, $size );

			echo '<li><a href="'.$attachmenturl.'" rel="shadowbox[photos]">'.$attachmentimage.'</a></li>' . "\n";
		}
	} else {
		echo "No Image";
	}
} ?>

Initial URL


Initial Description


Initial Title
Get Attached Images from Post on Wordpress

Initial Tags
post, wordpress

Initial Language
PHP