helgatheviking / Nav-Menu-Roles

Display / Hide wp_nav_menu() items by role
66 stars 32 forks source link

improvement request: date based filter #65

Closed vittorio-alfieri closed 1 year ago

vittorio-alfieri commented 1 year ago

could you add the ability to show or hide menu items between a start date and an end date?

helgatheviking commented 1 year ago

What's the use case here? Couldn't you remove the menu item when it's not time-appropriate?

vittorio-alfieri commented 1 year ago

Hi Katy, I manage the websites of some schools and sometimes I find myself having to plan the release of some articles and menu items in advance, for example during open school days or summer remedial courses, or enrollment pages for courses which are held only in certain periods of the year.

Il giorno mar 21 feb 2023 alle ore 19:54 Kathy @.***> ha scritto:

What's the use case here? Couldn't you remove the menu item when it's not time-appropriate?

— Reply to this email directly, view it on GitHub https://github.com/helgatheviking/Nav-Menu-Roles/issues/65#issuecomment-1438951069, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6ARBSKAOZIIK3FZ4OYFXOLWYUFMXANCNFSM6AAAAAAVDM3NPE . You are receiving this because you authored the thread.Message ID: @.***>

-- Istituto d'Istruzione Superiore "Marconi Pieralisi" - Via R. Sanzio, 8 - 60035 Jesi (AN) - Tel. 0731204550 - ANIS023002

Informativa ai sensi dell’ art. Art. 13 GDPR – Regolamento Generale sulla Protezione dei Dati (UE/2016/679)

Ricevete questa Mail perché siete inclusi nelle nostre liste, a seguito di regolari informative ed eventuali consensi dati. In caso non vogliate più essere presenti, o vogliate modificare i vostri dati, siete liberi di farlo, rispondendo a questa e-mail. Siete altresì tenuti a non dare diffusione degli eventuali dati contenuti in questa comunicazione, ai sensi dell’ art. 4, c. 12 GDPR. Se doveste essere stati erroneamente fatti destinatari della presente, vi preghiamo di distruggerla e di avvisare cortesemente il nostro Titolare.-------------------------------------------------------------------------------------------------------------------------------------------------------------

Privacy policy in accordance with Art. 13 – GDPR (EU/2016/679)

You receive this Email because you are registered at our site, and you have given your consent to a regular policy. In case you want to unsubscribe, or modify your subscription, feel free to do it by sending an email back or using our institutional mail. You shouldn’t spread around the contents of this communication, in accordance with art.4, c.12 GDPR. Had you mistakenly been targeted with this communication, please shred this document and kindly notify our data controller.

helgatheviking commented 1 year ago

Interesting, thank you for the explanation. The plugin is focused on hiding/showing items by role so I don't think a date-based feature is a good fit.

I bet you could write a custom snippet either mimicking my "pseudo" role tip here: https://github.com/helgatheviking/nav-menu-roles#adding-a-new-role

You could also write your own custom callback for wp_get_nav_menu_items

Or you could write your own custom interface by mimicking what I do in this plugin: Add a field Save the menu meta Setup the menu item with meta Use meta to hide/show menu item Though granted, this is only the old menu editor... supporting the customizer would be significantly more work and supporting the Full Site Editor isn't even possible yet.