Hello,
I have 2 methods in my functions.php to pull out the first image from a post's gallery.
Since upgrading to 2.8.4, the second one, get_first_image_medium, has stopped working.
Any ideas why much appreciated :)
Thanks,
James
function get_first_image_thumb() {
$files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image');
if($files) :
$keys = array_reverse(array_keys($files));
$j=0;
$num = $keys[$j];
$image=wp_get_attachment_image($num, 'large', false);
$imagepieces = explode('"', $image);
$imagepath = $imagepieces[1];
$thumb=wp_get_attachment_thumb_url($num);
print "<img src='$thumb' class='thumbnail' />";
endif;
}
function get_first_image_medium() {
$files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image');
if($files) :
$keys = array_reverse(array_keys($files));
$j=0;
$num = $keys[$j];
$image=wp_get_attachment_image($num, 'medium', false);
$imagepieces = explode('"', $image);
$imagepath = $imagepieces[1];
$thumb=wp_get_attachment_thumb_url($num);
print "<img src='$imagepath' class='thumbnail' />";
endif;
}