How to pull Featured Media through WP's featured image -tag?


I already asked this on other thread, but possibly because I'm such a neebie, I need some extra guidance :)

The site in question is, where I've created conditional tag for frontpage to show a slider, and all subpages to go with featured image set for them.

I have a template, which uses WP's featured image as a header image on pages. I use code as below to do that:

<?php global $post; ?>  
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array(1000,400), false, '' );  

Now, on BuddyPress members profile pages are obviously returning empty for featured image, because they are dynamic, and no option to set that in. Is there a way, to get Featured Media to be pulled through that code snippet? Or condition or something?

Because for some reason, I've set one picture as a featured media on my profile, but it returns nothing. Am I missing a function or something.

Thank you on forehand.


@villeterama-fi - You must be searching for this ->


Thanks Joshua,

I've tried to follow that and all, but that script is not returning a thing to me. And setting an image as featured, it does'nt pop-up in profile either, or should it appear somewhere by default?


As per the link I provided, the featured media would show up only at places where you have inserted rtmedia_featured($user_id) in your theme files. So basically it would depend on where you place the code.


You can find the code for its ouput here ->


Ok, and thank you a lot. I'll try.

Is it rt_media_featured (as mentioned here: or rtmedia_featured as you wrote here..?


It is as I have mentioned. Will be correcting the typo on that page too.



Attachment Link(s):


$user_id should be substituted with the user id of the user whose featured image you want to display.

Something like this

$user_id = get_current_user_id(); // for the logged in user id  


$user_id = bp_displayed_user_id(); // for the displayed users id  


Also you need to have set one of your media as featured.


WORKS! didn't know about that deifinion for user to be added. Thanks a punch!


Glad to know you could get it working :)