Welcoming Logged in user with display name in wordpress

On 2 Mar, 2012 in Wordpress with Comments

If we ever wanted to welcome user inside our WordPress theme use is_user_logged_in function to check whether the user logged in or or not

Welcoming Logged in user with display name in WordPress

Then Welcome him/her with their display name using following code

<?php
   if ( is_user_logged_in() ) {
      global $current_user;
      get_currentuserinfo(); 
      echo 'Hi there ' . $current_user->display_name;
      } 
?>

Hi there display name

Tags: ,