612-293-8629 [email protected]

I wrote a couple of days ago about how I customized the bp_has_groups() function to alphabetize my “All Groups” page in BuddyPress. But I have since been using that function to customize all sorts of things.

For example, the Group Authors List plugin by Eric Johnson displays a list of the most recently active 20 groups in its widget drop-down by default. I needed to do two things – display ALL the groups in the dropdown and alphabetize the listing of the groups. This was easy to do. I changed this:

<?php if ( bp_has_groups() ) : while ( bp_groups() ) : bp_the_group(); ?>

to this:

<?php if ( bp_has_groups('type=alphabetical&per_page=100') ) : while ( bp_groups() ) : bp_the_group(); ?>

But that’s not all! I also was having an issue with the groups listing’s AJAX, whereby the pagination was not working correctly. Rather than try to figure out how all that is put together (which would have been nice, btw, except time is of the essence), I simply added “per_page=100” to the bp_has_groups() function.

I am starting to realize that this function can be used much in the same way that “query_posts()” is used in normal WordPress theming.

bp_has_groups() in the BuddyPress Codex

PHONE, EMAIL, TEXT

We love to communicate: phone, email, text, Facebook, Twitter, LinkedIn, you name it.

LOCATIONS

PAYMENTS ACCEPTED

Call Now

Enroll in Our Free Beginner WordPress Class by Email

Never feel powerless in WordPress again!  Become a WordPress superstar for free in only minutes a day!

Our Beginner WordPress Email Class is delivered to your inbox!

Learn More 

You Have Successfully Enrolled! Prepare For Amazing!