
Add dynamic menu to specific custom menu
By: a guest on
Dec 29th, 2012 | syntax:
None | size: 0.54 KB | hits: 28 | expires: Never
// Filter wp_nav_menu() to add profile link to a specific wp_nav_menu
// For example: 'theme_location' =>'mamamia'
// Replace mamamia with your menu's theme_location
function mme_nav_menu_profile_link($menu, $args) {
$profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '">' . __('My Profile', 'buddypress' ) . '</a></li>';
if (is_user_logged_in() && ‘mamamia’ == $args->theme_location )
return $profilelink . $menu;
else
return $menu;
}
add_filter( ‘wp_nav_menu_items’, ‘mme_nav_menu_profile_link’, 10, 2);