How to create new dynamic menu including BP links?
-
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:
` ‘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?
-
I am having the exact same issue. I have items on the admin bar that I want on the menu bar such as “Activity” and “Profile”. Preferably with the nice drop downs of the admin bar. If I get the answer to this I am going to be so happy as I have only been using BP for a few days and WP for a few weeks.
My site is http://DayZClans.com you can see what I mean.
The ‘dynamic’ links, e.g. to a members profile, require PHP (to work out the path to the current member). You can’t add links that include PHP using the built-in WordPress nav menu system.
You’ll either have to add those menu options in your template files, or perhaps find a way to hook in to the WordPress nav menu system (read up on WordPress action hooks) to extend its capabilities to support dynamic PHP based URLs.
.. and here’s a write up on how to use hooks (or in this case filters), to add your dynamic menu item:
http://stackoverflow.com/questions/10644384/dynamic-url-in-wordpress-navigation
Obviously, you’ll have to adapt the code to add your BuddyPress profile links.
You can also ignore the comment about playing with the priority number for ordering (that’s nonsense). You’d have to take the item list (incoming parameter), and manipulate that – inserting your menu at the right point.
It’s not ‘cut and paste’ though, and you’ll need some reasonable PHP development skills to get it set up correctly.
hey roger,
You seem to know your stuff, unfortunately im not a php developer. I know a tiny html but that it. I can probably figure it out if you break it down a littler further for me (sorry).
Now would i the header php page?
- The topic ‘How to create new dynamic menu including BP links?’ is closed to new replies.