Hi,
Can anyone help me to show username with the link to my account page instead of links which is shown when user not logged in?

Many thanks.
Hi supermanikin,
I’m not sure if that could be achieved easily but send us a link to your page and we’ll have a look at it.
Best regards,
Rikard
I’m setting the secondary menu to that and still do not find any solution to make it automatically change after user logged in to “Welcome [username] Logout”.
Do you have any easy solution for that ?
Many thanks.
Hi,
Please add following code to Functions.php file of your child theme in Appearance > Editor
function avia_username_sc(){
$current_user = wp_get_current_user();
if(is_user_logged_in ()){
$output = '<span class="custom-un">Welcome ' . $current_user->user_login . '</span>';
}
else {
$output = '<a href="'.wp_login_url().'" title="Login" rel="nofollow">Login</a>';
}
return $output;
}
add_shortcode( 'username', 'avia_username_sc' );
add_filter('wp_nav_menu_items', 'do_shortcode');
then go to Appearance > Menus and a new custom link to your secondary menu with # for URL and [username] for navigation label.
Best regards,
Yigit
