This topic has 2 replies, 2 voices, and was last updated 5 years, 9 months ago ago by Olga Barlow
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 XYZ – My account – Logout” (the last two are links).
What code/script I need to add to the sidebar widget?
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
You must be logged in to reply to this topic.Log in/Sign up