Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Add BP profile link in wp_nav_menu

By: a guest on Dec 23rd, 2012  |  syntax: None  |  size: 0.37 KB  |  views: 3,943  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // Filter wp_nav_menu() to add profile link
  2. add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
  3. function my_nav_menu_profile_link($menu) {      
  4.         if (!is_user_logged_in())
  5.                 return $menu;
  6.         else
  7.                 $profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '">' . __('Visit your Awesome Profile') . '</a></li>';
  8.                 $menu = $menu . $profilelink;
  9.                 return $menu;
  10. }