When making customization for our WordPress theme, often we need to check if user is logged in. It is a simple task when using a WordPress function is_user_logged_in().
Here is a simple snippet that shows you how to check if user is logged in or not.
if(is_user_logged_in()) echo 'You are logged in.'; else echo 'You are not logged in.';