Support » Plugin: Max Mega Menu » Walker_Nav_Menu start_el method?

  • Hi- I’ve inherited a site that makes use of Max Mega Menu, and we’re trying to clean up some of the markup that is being output by the menu using standard WP nav walkers.

    It seems as though when Max Mega Menu is active, the start_lvl() and start_el() methods are never fired. If I disable the plugin, I see my custom walker code being executed, but when it’s enabled, it gets bypassed entirely.

    Is there some reason for this, and what do you recommend as an alternative to overriding the Walker_Nav_Menu class methods?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author megamenu

    (@megamenu)

    Hi Rob,

    We use our own Walker class, it is the ‘core’ of the plugin so it’s not really something you can swap out for your own. If you did you would need to replicate it pretty much in its entirety. What is the markup are you trying to change? Maybe I can tell you another way to do it, or let you know why it is required.

    Regards,
    Tom

    Yikes, I figured as much. I’m trying to rewrite links without HREFs (or w/ #) as spans. Doing it w/ JS isn’t an option.

    Not sure if the client is even really using any of the fancy functionality that MMM offers so we may just abandon it, but I didn’t want to have to re-do the CSS & JS for basic dropdown menus, so the walker would have been quicker.

    If you do have a way, I’d be open to hearing it though.

    Plugin Author megamenu

    (@megamenu)

    Hi Rob,

    Got it. If you look inside our walker class, you’ll find there is a filter applied to each menu item that is output:

    megamenu_walker_nav_menu_start_el

    You’d need to hook into that filter to adjust the output of items that have the linked disabled. You can check the ‘walker_nav_menu_start_el’ documentation (the only difference with our filter is that is prepended with ‘megamenu_’). Then you would also need to add some styling to style the new <spans> in the same way as the anchors.

    Regards,
    Tom

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Walker_Nav_Menu start_el method?’ is closed to new replies.