简体   繁体   中英

BuddyPress avatar showing up outside designated content

I have a BuddyPress member loop that includes the user avatar. The avatar is showing up, but outside it's wrapping html element.

if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) :

      $content.="<ul>";

      while ( bp_members() ) : bp_the_member();

      $content.="<li><a href='".bp_member_permalink()."'>".bp_member_avatar()."</a></li>";

   endwhile;

   $content.="</ul>";

else:

   $content.='You are not connected to any companies.';

endif;

The result is showing up with empty

<ul>
  <li></li>
</ul>

And the avatars are there, but above the actual list.

在此处输入图片说明

Any help would be great!

This function will echo the avatar: bp_member_avatar() . So it will appear as your code runs, rather than append it to $content . Try using bp_get_member_avatar() instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM