Login/Logout script - by designerobot - on WordPress WooCommerce support

This topic has 2 replies, 2 voices, and was last updated 5 years, 9 months ago ago by Olga Barlow

  • Avatar: designerobot
    designerobot
    Participant
    July 25, 2018 at 14:01

    Hi, because I disabled the top bar of the theme, I would like to add on my right sidedar a script to login/logout to the shop.

    It should show to a new user: “Login” (it’s a link)

    It should show to a logged user “Hi XYZMy accountLogout” (the last two are links).

    What code/script I need to add to the sidebar widget?

    1 Answer
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    July 25, 2018 at 14:38

    Hello,

    The simple way to implement something similar to what you want is:

    Create custom menu (Appearance > Menus) http://prntscr.com/kausqj with 3 links, last one should be created using the WC endpoints. Add the custom classes for the first one – hide-for-loggedin and for the next 2 items – hide-for-loggedout . Then add the following custom code in child theme style.css or in Custom CSS field of the parent theme.

    .logged-in .widget_nav_menu .hide-for-loggedin {
        display: none;
    }
    .widget_nav_menu .hide-for-loggedout {
        display: none;
    }
    .logged-in .widget_nav_menu .hide-for-loggedout {
        display: block;
    }

    Go to Appearance > Menus add the Navigation Menu widget into sidebar where you want to show the links.

    If this way is not suitable for you then you can try to create the special widget in case you have PHP skills or order customization here.

    Regards

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.