Show user name instead of Profile.
Is it possible that instead of Profile link in the menu it should show Username or just Name? if its possible please tell how it can be implemented
add this to your function.php:
add_filter(‘wp_nav_menu_items’,’my_login_func’, 10, 2);
function my_login_func($nav, $args) {
ob_start();
wp_loginout(‘index.php’);
$loginoutlink = ob_get_contents();
ob_end_clean();
//change primary to secondary if u use secondary menu
if( $args->theme_location == ‘primary-menu’ ) {
if(is_user_logged_in())
{
$user=wp_get_current_user();
$name=$user->display_name; // or user_login , user_firstname, user_lastname
$nav .= ‘<li><a href=”YOURLINK”>| Hi, ‘.$name.’ |</a></li>’;
$nav .= ‘<li>’. $loginoutlink .'</li>’;
}
else {
$nav .= ‘<li><a href=”YOURLINK”>| Login/Register |</a></li>’;
}
}
return $nav;