Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to have a login username and password field in the header, and a registration link beside it. I want the registration link to go away once the user is logged in and the login fields to be replace with a logout link.

I have found these two snippets but they don't help me achieve what I want.

share|improve this question
    
You said "snippets", but didn't show any... –  kaiser May 12 '11 at 0:35
add comment

1 Answer 1

up vote 2 down vote accepted
wp_login_form(); // Codex: http://codex.wordpress.org/Function_Reference/wp_login_form
// or:
wp_loginout(); // Codex: http://codex.wordpress.org/Function_Reference/wp_loginout
if ( ! is_user_logged_in() ) // Codex: http://codex.wordpress.org/Function_Reference/is_user_logged_in
    wp_register('', ''); // Codex: http://codex.wordpress.org/Function_Reference/wp_register
share|improve this answer
    
Thanks, however. that doesn't remove the login box after login, or provide a register link. –  Keith Groben May 12 '11 at 0:55
    
Straight from the Codex wp_register() functions description: "This tag displays either the Site Admin link if the user is logged in or Register link if the user is not logged in." The if ( ! is_user_logged_in() ) can be wrapped around any of those three functions - also around the wp_login_form() function. So everything you asked for is in those 5 lines of the answer including links to the Codex and the according description. - Btw: As mentioned above: Please provide your "snipplets" including an explanation how and where you placed them. –  kaiser May 12 '11 at 2:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.