If you allow people to sign up for your blog to comment or even contribute, here’s a simple snippet of code that you can place in your sidebar.php file to display a custom welcome greeting to your users. Visitors who are not logged in see the Log In or Register greeting. Cool, huh?
<?php
if (is_user_logged_in()) {
$user = wp_get_current_user();
echo 'Welcome back <strong>'.$user->display_name.'</strong>!';
} else { ?>
Please <strong><?php wp_loginout(); ?></strong>
or <a href="<?php echo get_option('home'); ?>/wp-login.php?action=register"> <strong>Register</strong></a>
<?php } ?>

Like this tutorial? I would love to hear from you in the comments…
