开发者

How to display Buddypress profile field content within the post loop

I have a Buddypress开发者_如何学Python profile field called “Bio”, and I’d like to display it’s content in the post footer, to show the author’s bio.

I’ve tried

<?php bp_member_profile_data('field=Bio');?>

and

<?php echo xprofile_get_field_data( 'Bio' );?>, 

but I’m still pretty lost.

How can I do this ?


Well of course you would first want to get the current user ID:

$current_user = wp_get_current_user();
$current_user_id = $current_user->ID;

Then, as confirmed through Buddypress 1.5:

<?php bp_profile_field_data( array('user_id'=>$current_user_id,'field'=>'bio' )); ?>


For me, this worked in author boxes:

<?php bp_profile_field_data( array('user_id'=>get_the_author_meta( 'ID' ),'field'=>'NAME_OF_THE_FIELD' )); ?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜