• 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:

    https://pastebin.com/4Bb4N8Ze

    (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

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

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

    $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

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

    deleted

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