Tagged: ,

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

    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.




    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!


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


    Then the logout link will be something like:


    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.


    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.



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

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