Check if user is logged in

If you have users on your WordPress blog, you can choose to display stuff just for them.

Code Snippet:

<?php
if ( is_user_logged_in() ) {
    echo 'Welcome, registered user!';
} else {
    echo 'Welcome, visitor!';
};
?>

Posted in Conditional