Perhaps I have missed something fundamental, but I am attempting to include the various dynamic menu items included with BuddyPress and other add-ons to my primary drop-down menu.
For example, the Twenty Eleven WP theme has a tall header with a drop-down menu beneath the header. This menu can be manipulated via the Appearance->Menus option in wp-admin. BuddyPress adds its own menu items to the admin bar at the top of the page but does not include these links in the drop-down menu below the header. I would like to remove the admin bar completely and relocate all dynamic links to the drop-down menu.
I have already created a custom menu in the functions.php
file:
function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __( 'Nav Menu' )
)
);
}
add_action( 'init', 'register_my_menus' );
And this menu is loaded in the header.php
with:
<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
I am able to add individual links to this menu using the wp_nav_menu_items
function, but cannot seem to be able to replicate the dynamic menu structure created by the bp_nav
functionality based on user.
Does anyone have ideas on how I could relocate this functionality? Or perhaps am I looking at the menu structure incorrectly?
Though I don’t have specific code to suggest, it seems like it would be possible to create something along the lines you mentioned by using a custom Nav Walker and generating buddypress-specific links with the
$bp
global (which you can learn more about here â http://codex.buddypress.org/developer/the-bp-global/).You could alter
$output
in the custom Nav Walker based on checks against$bp
, if it even exists.