I have a question-answer plugin installed so the post type is example.com/question/
I want to show the message just below the post content
it should say "Login or Register" to non logged in users
and welcome to logged-in users
I have a question-answer plugin installed so the post type is example.com/question/
I want to show the message just below the post content
it should say "Login or Register" to non logged in users
and welcome to logged-in users
2
Answers
You’re looking for
is_user_logged_in();
Try adding this code to your theme where applicable:
Also: WordPress has a native function for that –
wp_loginout()
:https://developer.wordpress.org/reference/functions/wp_loginout/
It won’t show the welcome message off the box, but will give logged in users the option to log out instead.