The7 theme for WordPress offers a Login / Logout microwidget that can be placed in the header of the website. This microwidget may be sufficient for some projects. But if you are using WooCommerce and want to improve the user experience for your visitors, you’ll want more customizable control. Here’s how to add Login / Logout links to The7 theme WordPress menu.
Add Login / Logout Links to The7 Theme WordPress Menu
This tutorial provides a code snippet that displays menu items in The7 theme’s microwidgets. It also uses Font Awesome 5 icons, which is included with the current version of The7 theme.
Before proceeding you’ll need to have access to The7 child theme’s functions.php file. Take a look at our article about WordPress child themes if you are unsure what you are using for your website.
Step 1
Ensure that you have added the “Menu 2” microwidget to the Top Bar & Header area where you’d like the menu to appear. These settings can be found in The7 theme options:
Theme Options > Top Bar & Header > Microwidgets
Step 2
Create a new menu in WordPress and assign it to the “Header Microwidget 2” display location:
Appeareance > Menus
You can place additional menu items in the menu, like Wishlist. However, the next step will be responsible for displaying the Login, Logout, and My Account menu items. You can leave the menu empty if you prefer. This will not prevent the code snippet from working.
Step 3
Copy and paste the following code snippet to your child theme functions.php file:
This code snippet will add the WordPress Login, Logout, and WooCommerce My Account links to the new menu that you created in Step 2.
Final Thoughts: Add Login / Logout Links to The7 Theme WordPress Menu
To sum up, if you are using The7 WordPress theme, this is a quick and easy way to create a better user experience for your website by adding the Login, Logout, and My Account links. Depending on if the user is logged in or logged out, the code snippet will display the correct menu items.
Special thanks to CollectiveRay’s article that this code snippet was built from and customized for The7 theme.
Need help? Our WordPress Development Service is a comprehensive solution for small, medium, and enterprise-level businesses. Call us at 602-633-4758 for a free consultation.
Hi there, thank you for this, I was searching for a while.
Question is, when I logout, I get the wordpress login screen, and would like to be logged out and return to the homepage of the store. Where do I change that code?
I figured it out!