Give custom class names to WP nav sub-menu

I was able to work this out by using a hook that I grabbed from Artemiy Egorov’s answer on this post https://stackoverflow.com/questions/5034826/wp-nav-menu-change-sub-menu-class-name so I figured I’d share in case someone else needs it too: add_filter( ‘nav_menu_submenu_css_class’, ‘rename_sub_menus’, 10, 3 ); function rename_sub_menus( $classes, $args, $depth ){ foreach ( $classes as $key => $class ) { … Read more

nav tag wrapping around dropdown

Setting specific min-width and max-width for your <nav> menu will fix the issue: <nav class=”navbar navbar-inverse navbar-fixed-top” role=”navigation” style=”min-width: 1000px; max-width: 1000px;”> Here’s the JavaScript/jQuery method that will set the min-width and max-width of your .navbar when the event ‘affix.bs.affix’ got fired: var navbar = jQuery(‘nav.navbar’); // If ‘affix.bs.affix’ is fired. navbar.on(‘affix.bs.affix’, function () { … Read more

Display sub menus as separate lists

I’ve decided to not change anything in walker class and “parse” the menu with jQuery, clone each children and append to “menu” container which gives me the result I was looking for. The only thing missing is how to pass ID of menu element which has childrens to start_lvl function. Thanks