Advertisement
Guest User

Add dynamic menu to specific custom menu

a guest
Dec 29th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. // Filter wp_nav_menu() to add profile link to a specific wp_nav_menu
  2. // For example: 'theme_location' =>'mamamia'
  3. // Replace mamamia with your menu's theme_location
  4.  
  5. function mme_nav_menu_profile_link($menu, $args) {
  6. $profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '">' . __('My Profile', 'buddypress' ) . '</a></li>';
  7. if (is_user_logged_in() && ‘mamamia’ == $args->theme_location )
  8. return $profilelink . $menu;
  9. else
  10. return $menu;
  11. }
  12. add_filter( ‘wp_nav_menu_items’, ‘mme_nav_menu_profile_link’, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement