How to create BuddyPress members widget

BuddyPress WordPress plugin is the backbone of WordPress social networking. If you are looking to create a social network on your existing WordPress platform, then you can choose BuddyPress. The plugin works like social networking for WordPress. In other words, BuddyPress allows you to register, create profiles, post messages, build connections, create groups.

To create an appealing and powerful BuddyPress social network, you need to have a stunning theme like BuddyBoss or Socialize Multi-Purpose theme.

BuddyPress says the plugin is “Fun & flexible software for online communities, teams, and groups”

In this article, I’m going to show how to add BuddyPress members widget in custom places or in a custom page.

The below method requires you to paste code into your Custom file. If you are new to adding this code to a file then take a look at HTML and PHP  guide.

You need to add the following code in your custom-file.php.

<div class="widget-content" id="boss_whos_online_widget_heartbeat">
<?php if ( bp_has_members( $members_args ) ) : ?>
<ul id="members-list" class="item-list" aria-live="polite" aria-relevant="all" aria-atomic="true">
while ( bp_members() ) : bp_the_member();
<li class="vcard">
<div class="item-avatar gr">
<a href="<?php bp_member_permalink(); ?>" class="bp-tooltip" data-bp-tooltip-pos="up" data-bp-tooltip="<?php bp_member_name(); ?>"><?php bp_member_avatar('small'); ?></a>
<div class="item">
<div class="item-title fn">
<a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a></div>

<?php endwhile; ?>

<?php endif; ?>

The above code takes default WordPress users’ name and their hyperlinks. You can test this by adding new users.

I hope this article helped you learn how to display BuddyPress Member widget in the custom template or in a custom place.

About the author


A coder who is trying to solve some problems via "Procoders", Software Engineer By Profession, WEB Enthusiast, Hobby Blogger. I love to share Tech Ideas and like to learn and explore new things and Technologies.

Add Comment

Click here to post a comment