how to set a function to see if you are loged in or not code example
Example: if user logged in wordpress
if ( is_user_logged_in() ) {
// your code for logged in user
} else {
// your code for logged out user
}
if ( is_user_logged_in() ) {
// your code for logged in user
} else {
// your code for logged out user
}