Add user profile button to theme menu
-
I’m new in wordpress development, Can you help me with this question:
I installed latest wordpress version and latest plugin buddypress version. Now I disabled wordpress admin bar for non admin users and I want move user profile button (screenshot below) into my theme Menu. https://s31.postimg.org/b0s2okcu3/one.png
My menu: https://s31.postimg.org/5dvpr3abf/two.png
Now I created new Menu items with login / logout / edit profile functions, but I dont understand how to insert user profile button into my menu.
There is my code:
function wpse_125929_login_logout( $items ) { if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); $profile_edit_url = admin_url( 'user-edit.php?user_id=' . $current_user->ID ); $profile_link = '<li><a href="' . $profile_edit_url . '">Edit Profile</a></li>'; $logout_url = '<li><a href="'. wp_logout_url() .'">Logout</a></li>'; $items = $items. $profile_link. $logout_url; } else { $login_link = '<li><a href="'. site_url('wp-login.php') .'">Log In</a></li>'; $items = $items. $login_link; } return $items; } add_filter( 'wp_nav_menu_items', 'wpse_125929_login_logout' );
How I can add user profile button to my menu?
Thanks in advance!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add user profile button to theme menu’ is closed to new replies.