Getting all Images from WordPress Post
Function
<?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 $attachmentimage;
}
}
else {
echo "No Image";
}
}
?>
Using Function
<?php postimage(array(32,32)); ?>
where 32,32=>image height width

Post a Comment