Passer la navigation

[Résolu] Different menu for logged in and logged offf user

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

I want to display different menus based on user login status and add user-friendly login and logout buttons in the menu.

Solution:

Use a plugin like WPCode to manage different menus based on user status. For the logout button, add a link with the URL http://example.com/wp-login.php?action=logout. Refer to the following documentation for generating the logout URL: https://developer.wordpress.org/reference/functions/wp_logout_url/.

Relevant Documentation:

How to Add the WordPress Logout Link to Navigation Menu: https://www.wpbeginner.com/wp-tutorials/how-to-add-the-wordpress-logout-link-to-navigation-menu/
WP Logout URL Documentation: https://developer.wordpress.org/reference/functions/wp_logout_url/

This support ticket is created Il y a 2 years. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Ce sujet contient 3 réponses, a 2 voix.

Dernière mise à jour par Christopher Amirian Il y a 2 years.

Assisté par: Christopher Amirian.

Auteur
Publications
#2697260

Hello,

How do I achieve this? I was thinking about creaating two different menus and then using a plugin such as wp code to display the correct menu according to the user logged in status?
Is there something easier?

Aslo what are the links to put for login and logout?

Thanks

Jacques

#2697289

Christopher Amirian
Supporter

Les langues: Anglais (English )

Hi Jacques,

Toolset does not have any control over the menus generated via Appearance > Menus on WordPress.

I did a Google search and there are some solutions that you can consider:

lien caché

Thanks.

#2697357

Ok thanks,

I will manage to do this.

Addititional question please : I want to add a logout button in menu.

What url should I use there, How can I make the url user friendly? Use a redirect?

Thanks,

Jacques

#2697656

Christopher Amirian
Supporter

Les langues: Anglais (English )

Hi Jacques,

That is also something you should do without Toolset as Toolset does not have such a feature.

You can look for a solution here:

lien caché

According to that documentation, you can use a code like this:

<em><u>lien caché</u></em>

Here is the official WordPress documentation on such a URL generation:

https://developer.wordpress.org/reference/functions/wp_logout_url/

Thank you.

#2698177

Perfect,

Thanks a lot,

Jacques