Support » Plugins » Hacks » A custom menu coding challenge – is it possible?

  • I have a client who’s designed a menu with a dropdown on only one item, and he’d like to have it use the new custom menu option. I know how to code custom menus but not with essentially a separate menu in the middle, and hence no idea how to code a custom menu to accomplish the code he has in mind. (The secondary menu also has alternating classes for the li’s, just to make things more interesting.) It is as follows:

    (The contents of the “bottom” div add styled corners to the end of the dropdown box.)

    Can anyone point me in a direction with this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Copy from nav-menu-template.php walker code, that start with
    “class Walker_Nav_Menu extends Walker {…” to your function.php, and rename it:), like this one: Walker_Nav_Menu_dropcornermenu

    $output .= "\n$indent<ul class=\"sub-menu\">\n";
    $output .= "\n$indent<div class=\"drop\"><ul class=\"sub-menu\">\n";

    and also:
    $output .= "$indent</ul>\n";

    $output .= "$indent</ul><div class=\"bottom\"><div class=\"box-center\"></div><div class=\"box-right\"></div></div></div>\n";

    After all, just call your nav_menu

    $walker_mymenu = new Walker_Nav_Menu_dropcornermenu ();
    wp_nav_menu( array ( 'walker' => $walker_mymenu  ) ); ?>


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘A custom menu coding challenge – is it possible?’ is closed to new replies.