I want to return multiple image attachments to my template landing page, but wp_get_attachment_image_src only returns the first image attachment. How come? Thanks in advance
<?php
/**
* Custom functions
*/
function get_images() {
global $post;
$size = 'medium';
$attachments = get_children( array(
'post_parent' => get_the_ID(),
'post_status' => null,
'numberposts' => -1,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'orderby' => 'menu_order'
) );
if (empty($attachments)) {
return '';
}
foreach ( $attachments as $id => $attachment ) :
return wp_get_attachment_image_src($attachment->ID, $size );
endforeach;
}
?>