Hi,
I use the following function to get the first image thumbnail of all the "attached images" of a post. I use it in my loop instead of the get_the_post_thumbnail so I don't have to manually set the thumbnail when creating the post :
<?php
function my_attachment_image_thumb($postid=0, $size='thumbnail', $attributes='') {
if ($postid<1) $postid = get_the_ID();
if ($images = get_children(array(
'post_parent' => $postid,
'post_type' => 'attachment',
'numberposts' => 1,
'orderby' => 'menu_order',
'post_mime_type' => 'image',)))
foreach($images as $image) {
$attachmenthumb=wp_get_attachment_image_src($image->ID, $size);
?><img src="<?php echo $attachmenthumb[0]; ?>" /><?php
}
}?>
And I know that the following function puts a thumbnail in the RSS feed, but it uses get_the_post_thumbnail, which I don't use and returns "empty" :
<?php
function insertThumbnailRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail' ) . '' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'insertThumbnailRSS');
add_filter('the_content_feed', 'insertThumbnailRSS');
?>
So can I somehow merge these two in order to get the first image thumbnail of all the "attached images" of a post inside my RSS feed ?
What would be the code for the function?
Many thanks for your time and help.