You could use some absolute positioning to place the login between other existing items if you need to. The only thing that would be tricky there is login and logout are slightly different size wise by a few pixels.
Here’s anther thought. There is a plugin called Nav Menu Roles (https://wordpress.org/plugins/nav-menu-roles/) that lets you display/hide navigation menu items based on the user’s WordPress role. What you could do is create two links, one for login, one for logout. Then display the login one for users with no role (those who aren’t logged in). For anyone with a role (those logged in) you would hide the login button and display the logout.
I haven’t tried that, but that might be an option and it’ll work on the mobile menu too.
I have the Nav Menu Roles installed and tried that before adding the custom function. The problem with that is adding the custom link to the menu. With logging in it’s fine, but logging out one would need to create a unique WP nonce to identify the logout. This I couldn’t manage to include in the custom link in the menu setting, because I couldn’t get the php to work inside the custom link field. Do you have any ideas, how this could be achieved?
Thanks in advance!:)
Viewing 3 posts - 1 through 3 (of 3 total)
The topic ‘Navigation bar item order’ is closed to new replies.
Keep In Touch
Sign up for our newsletter to always know what's happening at Organized Themes.