Support » Plugins » Can I programmatically assign a menu position with a new menu?

  • 1. I have support in my theme for two menus, “primary” and “secondary.”

    2. I have two menus defined: “Desktop” and “Mobile.”

    3. The “Desktop” menu is in the “primary” position. The “Mobile” menu is currently unassigned.

    What I need is either of the following, which will have the same effect:

    A. change the menu assigned to ”primary” from ”Desktop” to ”Mobile.”

    B. when the primary menu is shown, show the secondary menu instead (this implies that the “Mobile” menu is assigned to the “Secondary” position).

    Is this possible? I sure can’t find anything in the codex to handle this.

    If you’re curious as to why, here is why:

    The Desktop menu includes items with submenus and the submenus drop down from a trigger menu item. And in addition to the submenu items in the dropdown being clickable, the trigger item itself is clickable as well.

    So for example, the “Info” menu item:
    – when rolled over, shows the submenu
    – when clicked, shows the Info page

    All fine, except on touch devices which don’t have a hover state: when touching the Info item, it registers as both a click and a hover, and so the submenu is never seen before the browser is sent to the page linked to by the Info menu item.

    “But Mike, why not just remove the click link from the menu items that have dropdown menus?”

    That may be the end game here. But if it’s a simple reassignment of the menus, I’d rather do that.

    Anyone have any clues?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Can I programmatically assign a menu position with a new menu?’ is closed to new replies.