Forums

[resolved] Login Link (5 posts)

  1. charlieholder
    Member
    Posted 4 years ago #

    I would like to know how to get a login/logout link on the menu list. I don't like new/potential users having to click the register/site admin link and then clicking the login link at the bottom.

    I remember there being a wp_login() function or something like that in an older version, I tried using it with no success. Any pointers to an API page to look at or some advice is appreciated.

  2. boober
    Member
    Posted 4 years ago #

    try
    <?php wp_loginout(); ?>

  3. charlieholder
    Member
    Posted 4 years ago #

    That did the trick. Thank you very much.

  4. stu-in-flag
    Member
    Posted 3 years ago #

    This worked great for the log-in and log-out, but I also use a "register" link on my menu. Is there a way to combine all three functions so that logged-in users don't have to have the register button?

    Sorry, just haven't gotten around to learning php.

    Thanks,
    Stu

    http://stu-in-flag/blog/

  5. Dgold
    Member
    Posted 3 years ago #

    Stu,
    http://codex.wordpress.org/Template_Tags/wp_register

    This tag displays either the "Register" link to users that are not logged in or the "Site Admin" link if a user is logged in.

    So your buttons would say either:

    FOR NOT LOGGED IN PERSON:
    Register | Login

    OR

    FOR LOGGED IN USER:
    Site Admin | Logout

    Personally I make efforts to delete these links from my themes, for any site that isn't collecting registrants. If you just have a few authors (or just yourself) then memorize the URL's you need (or bookmark them) and remove the links from your public website theme to avoid reader confusion and unnecessary log-in attempts.

    The URL's you need are simply:

    Yoursite.com/wp-login.php
    Yoursite.com/wp-admin

Topic Closed

This topic has been closed to new replies.

About this Topic