Skip to:

Re: Adding menu items to the admin bar




The code I’ve posted is actually quite simple when you get right down to it. Simple yet powerful. It does everything you want a dropdown menu to do, and it does it all automatically behind the scenes.

It starts by identifying what links belong to dynamically generated BP directories and adds those to the adminbar in a Community dropdown. To that same dropdown, It then adds all BP directories that are created by any BP plugins you may have installed.

It then identifies all WP pages and adds them to the adminbar also. The really cool part is no matter how you’ve set up your WP page hierarchy and page order in your dashboard, that will be preserved in hierarchical dropdowns like the following example:

Parent page 1
– Child page 1
— Grand-child page 1
– Child page 2
– Child page 3…

Go ahead, give it a whirl. Copy the code to bp-custom.php and upload to your plugins folder. No need to activate anything; Buddypress will recognize and execute the code.

Take a look at my homepage:

The first dropdown is all Buddypress. The ones after it are all WP. If you create an account and login, you’ll see all the adminbar goodies appear to the left and bump everything else to the right.

Skip to toolbar