Logout then profile in nav
-
I am working on this website, I added this code (below) to have the profile redirect to our dashboard using WPML. The nav however is out of order, and I do not know how to arrange this nav.
So we have Home | About us | Logout | Profile
The profile is added by the code in the function.php (below), which means it is not arranged by the menu section on the WP. I have a conditional navigation. So when not login, I got Register | Login only. Once I login I have Home | About us |
So the logout and the profile are added by the code below. How do I arrange it that the logout will be at the end?
add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' ); function my_nav_menu_profile_link($menu) { if (!is_user_logged_in()) return $menu; else $current_user = wp_get_current_user(); $user=$current_user->user_login ; $profilelink = '<li><a href="' . bp_loggedin_user_domain( '/dashboard' ) . '">' . __('Profile') . '</a></li>'; $menu = $menu . $profilelink; return $menu; }
Please and thank you,
- You must be logged in to reply to this topic.