Guest User

Add BP profile link in wp_nav_menu

a guest
Dec 23rd, 2012
13,816
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data