Tagged: ,

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #21640

    I want to move the login/logout button beside the search bar into my main menu. Thanks!

    #112566

    Hi tlewebdev,

    That is a custom function to detect logged in and change based on that so it isn’t able to just get wrapped into the main menu like that.

    The only alternative that I could see working would be to add both a login and logout link into your menu and then use a bit of css to hide one or the other depending on the logged state of the viewer.

    Regards,

    Devin

    #112567

    what are the login / logout links? b/c the link I have when i log out redirects me to the /wp-admin page. care to share what the css would look like? thanks!

    #112568

    You can create the login page with this shortcode in the page visual editor via woocommerce:

    [woocommerce_my_account]

    Then the logout link will be something like:

    http://yoursite.com/wp-login.php?action=logout

    Then you use the .logged-in #menu-item-123 where 123 is the menu id number for the login link and do display:none as the css. Do the opposite with logout.

    It depends on your exact menu ID set up so is a bit hard to do as a copy+paste.

    #112569

    Just an added bit, the CSS using some sample menu ID’s would be this:

    /*Hide Logout unless logged in*/
    #menu-item-42 {
    display: none;
    }
    .logged-in #menu-item-42 {
    display: block;
    }

    /*Hide Login when Logged in*/
    .logged-in #menu-item-41{
    display: none;
    }

    Where 42 is the Logout menu ID and 41 is the Login menu ID.

    Regards,

    Devin

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Login Logout’ is closed to new replies.