Show/hide menu items at scheduled time: add release and expiry dates/time to menu items

When sites are being updated, it is common to have a release time for updates. This release time may be at an inconvenient time for the developer. Frequently site updates will mean new sections of the site are being added or removed. To add and remove sections of the website it would be great to have the ability for new sections of the menu to be automatically released, and old sections of the menu to expire and be hidden.

I propose adding the ability to enable release and expirty date/times to menu items.

Similar to custom modules, we would have the ability to enable release and expiry under settings for the menu:

When release/expiry are set then we would have the option to set them on a per-menu-item basis:


Would be useful Alex but you could do it now using the Custom Attribute Field in the menu.

Set Attribute Pairs like releaseDate=“dd/mm/yyyy” and/or expiryDate=“dd/mm/yyyy” in the Custom Attribute Field

Then in the Menu Item layout read the Custom Attribute & show or hide the item appropriately.

Check it exists, do the date calcs, and show/hide the menuItem something like this:

if customAttribute exists
    do dateCalcs
    if today > releaseDate(in customAttribute) and today < expiryDate(in customAttribute)
      show the menuItem

I haven’t tried to set up Release Dates or Expiry Dates but it should be easy enough to set up until this gets implemented. You’d also have to check for releaseDate only or expiryDate only.

I use something similar for a Club Member Site to show/hide menu items according to who is logged in. I’m checking for Logged in and whether a Member, a Walk Leader or a Committee Member, based on other data in the CRM or in custom modules. Liquid renders the Menu Item if appropriate rather than relying CSS to show/hide the Menu Item.

In my case the URLs in the Menu Items are in a ‘Members Only’ Secure Zone and also controlled by a security check.