I'm displaying latest 10 images uploaded by the displayed users in their respective profile page (buddypress.. I'm using this code to pull the images:
$media = get_posts(array(
'author' => bp_displayed_user_id(),
'post_type' => 'attachment',
'numberposts' => 10,
'post_mime_type' => 'image/jpeg' ));
foreach ($media as $image) {
list($src) = wp_get_attachment_image_src( $image->ID, 'thumbnail');
echo 'img src="'.$src.'" >';}
They work fine but here I'm unable to link the images to respective blog post.. They are simply showing the images without link attached to it.. I want to link all those images to it's parents blog post..
Thanks.. Your volunteered help will be highly appreciated..