// Register nav menus in bp-custom.php
<?php
if ( function_exists( 'register_nav_menus' ) ) {
register_nav_menus( array(
'bp_adminbar_user1' => __( 'Adminbar links 1'),
'bp_adminbar_user2' => __( 'Adminbar links 2')
) );
}
for flexibility? two menus registered
?>
// Begin pcwriter's 'pages' function
<?php
function pages(){
?>
<ul><!-- Community Drop Down -->
<li
<?php if (bp_is_page( BP_ACTIVITY_SLUG ) ||
bp_is_page( BP_MEMBERS_SLUG ) || bp_is_member() ||
bp_is_page( BP_GROUPS_SLUG ) || bp_is_group() ||
bp_is_page( BP_FORUMS_SLUG ) ||
bp_is_page( BP_BLOGS_SLUG ) ) : ?> class="selected"<?php endif; ?>>
<a href="<?php echo site_url() ?>/<?php echo BP_ACTIVITY_SLUG ?>/" title="<?php _e( '', 'buddypress' ) ?>"><?php _e( 'Community', 'buddypress' ) ?></a>
<ul>
<?php if ( 'activity' != bp_dtheme_page_on_front() && bp_is_active( 'activity' ) ) : ?>
<li<?php if ( bp_is_page( BP_ACTIVITY_SLUG ) ) : ?> class="selected"<?php endif; ?>>
<a href="<?php echo site_url() ?>/<?php echo BP_ACTIVITY_SLUG ?>/" title="<?php _e( 'Activity', 'buddypress' ) ?>"><?php _e( 'Activity', 'buddypress' ) ?></a>
</li>
<?php endif; ?>
<li<?php if ( bp_is_page( BP_MEMBERS_SLUG ) || bp_is_member() ) : ?> class="selected"<?php endif; ?>>
<a href="<?php echo site_url() ?>/<?php echo BP_MEMBERS_SLUG ?>/" title="<?php _e( 'Members', 'buddypress' ) ?>"><?php _e( 'Members', 'buddypress' ) ?></a>
</li>
<?php if ( bp_is_active( 'blogs' ) && bp_core_is_multisite() ) : ?>
<li<?php if ( bp_is_page( BP_BLOGS_SLUG ) ) : ?> class="selected"<?php endif; ?>>
<a href="<?php echo site_url() ?>/<?php echo BP_BLOGS_SLUG ?>/" title="<?php _e( 'Member Blogs', 'buddypress' ) ?>"><?php _e( 'Member Blogs', 'buddypress' ) ?></a>
</li>
<?php endif; ?>
<?php if ( bp_is_active( 'groups' ) ) : ?>
<li<?php if ( bp_is_page( BP_GROUPS_SLUG ) || bp_is_group() ) : ?> class="selected"<?php endif; ?>>
<a href="<?php echo site_url() ?>/<?php echo BP_GROUPS_SLUG ?>/" title="<?php _e( 'Groups', 'buddypress' ) ?>"><?php _e( 'Groups', 'buddypress' ) ?></a>
</li>
<?php if ( bp_is_active( 'forums' ) && bp_is_active( 'groups' ) && ( function_exists( 'bp_forums_is_installed_correctly' ) && !(int) get_site_option( 'bp-disable-forum-directory' ) ) && bp_forums_is_installed_correctly() ) : ?>
<li<?php if ( bp_is_page( BP_FORUMS_SLUG ) ) : ?> class="selected"<?php endif; ?>>
<a href="<?php echo site_url() ?>/<?php echo BP_FORUMS_SLUG ?>/" title="<?php _e( 'Group Forums', 'buddypress' ) ?>"><?php _e( 'Group Forums', 'buddypress' ) ?></a>
</li>
<?php endif; ?>
<?php endif; ?>
<?php do_action( 'bp_nav_items' ); ?><!-- Add BP- Plugin Directories to Community Drop Down -->
</ul>
</li>
<li>
<?php wp_list_pages( 'title_li=&depth=20&exclude=' . bp_dtheme_page_on_front() ); ?>
</li>
// Add call to nav menus
<?php if(has_nav_menu('bp_adminbar_user1')): ?>
<li><a href="<?php site_url() ?>">my links 1</a>
<?php wp_nav_menu(array('sort_column' => 'menu_order', 'container' => '', 'fallback_cb' => '', 'theme_location' => 'bp_adminbar_user1')) ?>
</li>
<?php endif; ?>
<?php if(has_nav_menu('bp_adminbar_user2')): ?>
<li><a href="<?php site_url() ?>">my links 2</a>
<?php wp_nav_menu(array('sort_column' => 'menu_order', 'container' => '', 'fallback_cb' => '', 'theme_location' => 'bp_adminbar_user2')) ?>
</li>
<?php endif; ?>
// end additions to original script
</ul>
<?php
}
add_action( 'bp_adminbar_menus', 'pages', 15 );
?>