Add All Pages To Buddypress Admin Bar Dynamically
Written by Erock
Monday, 6 September 2010 12:20
Want to add all your pages into your buddypress admin bar automatically?
It’s easy as pie! Just add wp_list_pages to your buddypress bar with the following code!
Create a file called erocks-admin-bar-mod.php in your /plugins/ dir, put in the following code, then activate the BP Nav Bar Mods Plugin on the plugin control panel
<?php
/*
Plugin Name: BP Nav Bar Mods – Add All Pages
Plugin URI: http://erikshosting.com
Description: Add All Your Pages To The Buddypress Admin Bar Automatically!
Author: Erock
Version: 1.0
Author URI: http://erikshosting.com
*/
//Links and Menus Added To The Following Function Are Always Visible On The BP Bar
function bp_adminbar_currentsite_menu() {
global $bp;
?>
<!– Call All Pages Via A WordPress Shortcode! –>
<?php wp_list_pages(‘title_li=’); ?>
<?php
}
// Call The Function Above
add_action(‘bp_adminbar_menus’, ‘bp_adminbar_currentsite_menu’, 999);
?>
{/code}
Or How About As A Drop Down Menu?
<?php
/*
Plugin Name: BP Nav Bar Mods – Add All Pages
Plugin URI: http://erikshosting.com
Description: Add All Your Pages To The Buddypress Admin Bar Automatically!
Author: Erock
Version: 1.0
Author URI: http://erikshosting.com
*/
//Links and Menus Added To The Following Function Are Always Visible On The BP Bar
function bp_adminbar_currentsite_menu() {
global $bp;
?>
<!– Call All Pages Via A WordPress Shortcode As A Drop Down! –>
<li><a href=”#”>Pages</a>
<ul>
<?php wp_list_pages(‘title_li=’); ?>
</ul>
</li>
<?php
}
// Call The Function Above
add_action(‘bp_adminbar_menus’, ‘bp_adminbar_currentsite_menu’, 999);
?>
{/code}
4 Comments
Leave a Reply
Categories
Archives
- Pro -Sites Shortcodes, Functions, And Level Checks
- Automatic WP Photo Gallery From Facebook Page Photos!
- Analytics 360 For Editors
- Add nofollow rel tags to image widget
- Image Widget Alignment Fix
- Add GD Star Rating next to Post Title
- Change The Buddypress Admin Bar Logo And Link In WP3 & BP 1.2+!
- New Dashboard Lockdown & WordPress To Buddypress Profile Page Plugin!
- Hide The WordPress Dashboard and wp-admin COMPLETELY!
- Blogs & Members Directory, Strange Nav Spacing FIX
















































Thanks I bookmarked this page and will try it out soon. Is this a dropdown menu? As you can see in my website, I want to rewrite the menu items “pages and categories” in a more dynamic way.
No, it wasn’t, but I just added another snippet to the article with the code to show it as a drop down. Its just underneath the first.
Eric,
Great tutorial – how would we make the new menu only visible to logged-in users?
Thanks!
put the menu items you want to be logged-in user only visible, inside a logged in check.
Use this http://codex.wordpress.org/Function_Reference/is_user_logged_in