- This topic has 2 replies, 2 voices, and was last updated 5 years, 1 months ago by .
-
Ticket
-
Hello,
I want to show the login name of the users in the topbar.
Here is the code which i use in the functions php:add_filter( 'wp_nav_menu_items', 'my_custom_menu_item'); function my_custom_menu_item($items) { if(is_user_logged_in()) { $user=wp_get_current_user(); $name=$user->display_name; // or user_login , user_firstname, user_lastname $items .= '
- Welcome '.$name.'
'; } return $items; }But now the “Welcome xy” is in all menus, how can i refere only to the topbarmenu?
Thanks,
Felix
Sorry, only verified customers can view ticket replies.