If Menu – Visibility control for Menu Items

Descripción

Control what menu items your site’s visitors see, based on visibility rules. Here are a few examples:

  • Muestra un elemento de menú solo si el usuario está conectado
  • Hide menu items if Device is mobile
  • Muestra elementos de menú solo para Administradores y editores
  • Hide Login or Register links for Logged in Users
  • Display menu items for Users from US or UK
  • Display menu items only for Customers with active membership
  • Display menu items for visitors browsing with Language English or Spanish

El plugin es fácil de usar, cada elemento de menú tiene una opción «Cambiar visibilidad del elemento del menú» que permitirá la selección de reglas (ejemplo en las capturas de pantalla)

Características

  • Conjunto básico de reglas de visibilidad
    • Estado del usuario El usuario está conectado
    • Perfiles de usuario Admin Editor Autor etc
    • Tipo de página Portada Página Entrada
    • Visitor device Is Mobile
  • Advanced visibility rules – requires Premium plan
    • Visitor location – detect visitor’s Country
    • Visitor language – detect visitor’s selected Language
    • WooCommerce Subscriptions – Display menus for users with active subscription
    • WooCommerce Memberships – Display menus for customers with active membership plans
    • Groups – Detect if users are in specific groups
    • WishList Member – Detect the users’ membership level
    • Restrict Content Pro – Detect the users’ subscription level
  • Varias reglas – mezcla varias reglas de visibilidad en un elemento de menú
    • mostrar si el usuario está conectado Y el dispositivo es móvil
    • mostrar si el usuario es Admin Y está en portada
  • Te permite añadir tus propias reglas personalizadas

Un ejemplo de añadir una nueva regla de visibilidad se describe en la sección de preguntas frecuentes

Capturas

  • Permite reglas de visibilidad en los elementos de los menús
  • Ejemplo de reglas de visibilidad

Preguntas frecuentes

If Menu is broken, no visibility rules are available

The code for modifying the menu items is limited and if other plugins/themes try to alter the menu items, this plugin will break.

This is an ongoing issue with WordPress which hopefully will be fixed in a future release.

Try to use just one plugin that changes functionality for menu items.

¿Cómo puedo agregar una regla de visibilidad personalizada a elementos del menú?

Nuevas reglas pueden ser agregadas por otro plugin o plantilla

Example of adding a new custom rule for displaying/hiding a menu item when current page is a custom-post-type.

// theme's functions.php or plugin file
add_filter('if_menu_conditions', 'my_new_menu_conditions');

function my_new_menu_conditions($conditions) {
  $conditions[] = array(
    'id'        =>  'single-my-custom-post-type',                       // unique ID for the rule
    'name'      =>  __('Single my-custom-post-type', 'i18n-domain'),    // name of the rule
    'condition' =>  function($item) {                                   // callback - must return Boolean
      return is_singular('my-custom-post-type');
    }
  );

  return $conditions;
}
Where can I find conditional functions?

WordPress provides a lot of functions which can be used to create custom rules for almost any combination that a theme/plugin developer can think of.

Reseñas

agosto 6, 2019
Does exactly as described. Thanks for this simple but effective plugin for helping me control what menu items are displayed on my eCommerce/membership sites. This is really useful!
mayo 18, 2019
I tried a number of plugins before settling on this one. None of the others allowed granular control and limited to being logged in, out or by user role. But I need to be able to target unregistered/logged out AND certain roles. With this I can choose whether to show OR hide something meaning I can hide menu items except for certain roles and then the inverse to show exactly what I need. Thanks for the excellent plugin! I work with a lot of non-profits and the free features are a life saver! 🙂
mayo 2, 2019
This plugin does exactly what I was looking for and does it well to boot, thank you for this nice plugin.
Leer todas las 87 reseñas

Colaboradores y desarrolladores

“If Menu – Visibility control for Menu Items” es un software de código abierto. Las siguientes personas han colaborado con este plugin.

Colaboradores

“If Menu – Visibility control for Menu Items” ha sido traducido a 3 idiomas locales. Gracias a los traductores por sus contribuciones.

Traduce “If Menu – Visibility control for Menu Items” a tu idioma.

¿Interesado en el desarrollo?

Revisa el código , echa un vistazo al repositorio SVN o suscríbete al registro de desarrollo por RSS.

Registro de cambios

0.15 – 2 July 2019

  • Updated – Texts & styles for If Menu settings page
  • Fixed – PHP error that may appear for Visibility Rules saved before If Menu v0.9

0.14 – 2 May 2019

  • Added – «User registration is allowed» visibility rule
  • Updated – Improved support for setting multiple visibility rules, without eval function from PHP
  • Updated – Show Membership Levels from «WishList Member» plugin
  • Updated – Compatibility with WordPress 5.2

0.13 – 8 April 2019

  • Updated – Compatiblity with latest WordPress version
  • Updated – Texts & more info about Premium plan
  • Added – Visibility rule – User has expired Subscription, integration with Restrict Content Pro plugin
  • Updated – Visibility rule – Restrict Content Pro Membership shows Level number

0.12.2 – 3 September 2018

  • Fixed – PHP error blocking page load (function formatting language names)

0.12 – 3 September 2018

  • Added – Visiblity rule – Detect visitor’s selected language
  • Updated – Link to Support Request email
  • Fixed – Better check for Premium plan after purchase (was not enabled in some cases)

0.11 – 23 Jul 2018

  • Fixed – Blank page on «Appearance -> Menus»
  • Fixed – Better compatitility with themes / plugins

0.10 – 8 May 2018

  • Added – Visibility rule – User has Subscription Level, integration with Restrict Content Pro plugin
  • Fixed – Display all WooCommerce Membership plans and save the visibility rule
  • Fixed – Small render artifact in menu item title

0.9 – 21 April 2018

This version requires PHP version to be at least 5.4
* Added – Visibility rule – Customer has active membership, integration with WooCommerce Memberships plugin
* Added – Visibility rule – Customer has active Job Manager Listing Subscription, integration with Listing Payments for WP Job Manager plugin
* Added – Option to disable menu item filtering in Admin panel
* Updated – Texts and notices

0.8.3

Release Date – 22 February 2018

  • Fixed – Support for PHP <= 5.3, fixes error

0.8.2

Release Date – 20 February 2018

  • Fixed – Support for older visibilty rule names, fixes PHP warning

0.8.1

Release Date – 20 February 2018

  • Fixed – Better options checking, fixes PHP warning

0.8

Release Date – 19 February 2018

  • Added – Visibility rules with multiple options. Requires Premium plan
  • Added – Visibility rule – User country
  • Added – Visibility rule – Is Super Admin on MultiSite
  • Added – Visibility rule – User is in Group, integration with Groups plugin
  • Added – Visibility rule – User has subscription, integration with WooCommerce Subscriptions plugin
  • Added – Visibility rule – User has active membership plan, integration with WooCommerce Memberships plugin
  • Added – Visibility rule – User membership level, integration with WishList Member plugin
  • Updated – Better conflict detection for Nav_Menu Walker
  • Fixed – translation strings & function used

0.7

Fecha de lanzamiento – 18 de Septiembre de 2017

  • Mejora – Mejor presentación para reglas de visibilidad
  • Agregado – Opción de previsualización – Permite a los administradores ver elementos ocultos del menú
  • Agregado – Página de ajustes

0.6.3

Fecha de lanzamiento – 17 de Agosto de 2017

  • Nueva regla de visibilidad – Idioma es RTL
  • Corrección – Regla simple funciona en servidores con Eval desabilitado

0.6.2

Fecha de lanzamiento – 8 de Agosto de 2017

  • Fix – Backwards compatibility with PHP < 5.4

0.6.1

Release Date – 7 August 2017

  • Improvement – Change labels & texts for easier use
  • Mejora – Mejora compatibilidad con últimas versiones de WordPress
  • Improvement – Better compatibility with translation plugins
  • Corrección – Detección de conflicto con otros plugins

0.6

Release Date – 27 August 2016

  • Improvement – Dynamic conditions based on default & custom user roles (added by plugins or themes) thanks Daniele
  • Improvement – Grouped conditions by User, Page or other types
  • Fix – Filter menu items in admin section
  • Fix – Better menu items filter saving code

0.5

Release Date – 20 August 2016

  • Improvement – Support for WordPress 4.6
  • Feature – New condition checking logged in user for current site in Multi Site [requested here](https://wordpress.org/support/topic/multi-site-user-is-logged-in-conditi
    on)
  • Feature – Added support for multi conditions thanks for this ideea
  • Improvement – RO & DE translations

0.4.1

Release Date – 13 December 2015

  • Fix – Fixes issue with adding new menu items

0.4

Release Date – 29 November 2015

0.3

  • Plugin icon
  • Set as compatible with WordPress 4

0.2.1

Minor fixes

  • Fix – Editing menus – show/hide conditions when adding new item (thanks Joseph Segal)

0.2

Update for compatibility with newer versions of WordPress

  • Feature – access to menu item object in condition callback (thanks BramNL)
  • Fix – alert for leaving page even if no changes were made for menus (thanks Denny)
  • Fix – update method in Walker_Nav_Menu_Edit to be compatible with newer version of WP
  • Fix – example in Readme (thanks BramNL)

0.1

  • Plugin release. Included basic menu conditional statements