May 4, 2009
Show Username of Logged-in User

If you want to show the username of a logged-in user in some place other than the meta sidebar widget that comes pre-loaded with WordPress, you can do so by placing the following code anywhere in your WordPress theme, and it will accomplish this simple task:
<?php global $current_user; if ( isset($current_user) ) { echo $current_user->user_login; } ?>
Thanks Pro Blog Tutorials for this simple little WordPress hack!
Related posts:
- How to Number Your Comments
- Show latest posts in the sidebar
- Display the total number of users of your WordPress blog
- Display Today’s Date on your Blog
- How to preset text in the WordPress post editor
Previous Post and Next Post













