I am using this function to retrieve the first image from a gallery in a post.
However this doesn't work properly when I re-order the images in the gallery. It is stuck with the first image at the first time of the upload.
Any other ideas on always getting the first image as shown in the gallery?
function echo_first_image ($postID)
{
$attachments = get_children(
array(
'numberposts' => -1,
'order'=> 'ASC',
'post_mime_type' => 'image',
'post_parent' => get_the_ID(),
'post_type' => 'attachment'
));
$first_attachment = reset($attachments);
//$last_attachment = end($attachments); or last image
echo wp_get_attachment_image($first_attachment->ID, 'full');
}