Saltar navegación

[Resuelto] Different menu for logged in and logged offf user

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

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 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.

Este tema contiene 3 respuestas, tiene 2 mensajes.

Última actualización por Christopher Amirian 2 years ago.

Asistido por: Christopher Amirian.

Autor
Mensajes
#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
Colaborador

Idiomas: Inglés (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:

enlace oculto

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
Colaborador

Idiomas: Inglés (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:

enlace oculto

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

<em><u>enlace oculto</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