I’m new to BP and WP! I have a quick question:
How can I show a one-line bio beneath usernames in the list of members in the ‘Members’ page of my BuddyPress website? For example, Facebook has a similar feature; it shows a name with a description beneath, e.g. ‘John Smith’ with ‘Engineer at Nuts & Bolts Co’ right beneath it.
I found the following line of code in member-header.php:
<h2 class=”user-nicename”>@<?php bp_displayed_user_username(); ?></h2>1
I thought about adding another line beneath for the bio field, but I’m not sure what to replace “bp_displayed_user_username();” with – I don’t think there is a “bp_displayed_user_bio();”. Should I create it? If so, how?
Thank you for your time!
'member-header.php' is for single member pages. If you want the bio to display on singe member pages, create a template overload.
Then add this:
<?php
$bio = xprofile_get_field_data('Bio');
//If the field is not called Bio, then change it above
if( !empty( $bio )
echo 'Bio: ' . $bio;
?>
If you want Bio to display on the members page that shows all members, then create a template overload of this page: \buddypress\bp-templates\bp-legacy\buddypress\members\members-loop.php
And look for this: bp_member_profile_data( 'field=the field name' );
Uncomment it and change to to, for example, bp_member_profile_data( 'field=Bio' );