Merge two separate WP menus into one in Mobile view

I had the same problem. The solution I chose was to “merge” the menus by placing them under a single div wrapper but have them on separate div class. Something like this: <div class=”menu-wrapper”> <div class=”menu1″> <?php wp_nav_menu( array( ‘theme_location’ => ‘menu-1’, ‘menu_id’ => ‘top-menu’, ) ); ?> </div> <div class=”menu2″> <?php wp_nav_menu( array( ‘theme_location’ … Read more

Show link to add menu

Its possible: if (has_nav_menu(‘topheader’)) { // User has assigned menu to this location; // output it wp_nav_menu(array( ‘theme_location’ => ‘topheader’, ‘menu_class’ => ‘topMenu’, /* bootstrap ul */ ‘walker’ => new My_Walker_Nav_Menu(), /* changes to a bootstrap class */ ‘items_wrap’ => ‘<ul id=”%1$s” class=”%2$s”>%3$s</ul>’, ‘menu_id’ => ‘topMenu’ )); }else{ if (is_user_logged_in()) { //we check if the … Read more

Walker_Nav_Menu: Items not nested correctly

You have this problem, because of your code 😉 function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $ident = str_repeat( “\t”, $depth ); if ( $args->walker->has_children ) { $classes=”menu-item-has-children menu-item menu-item-” . $item->ID; // actual link // you SHOULDN’T close the li tag in here $output .= “$ident<li … Read more

WordPress wp_nav_menu with a nav tag

You were really close. There is container argument for wp_nav_menu: ‘container’ (string) Whether to wrap the ul, and what to wrap it with. Default ‘div’. Its default value is ‘div’, which means, that the ul will be wrapped with div tag. You can change it to false – ul won’t get wrapped at all in … Read more

How do I prevent the text overflow in menu?

If you use your browser’s inspector f12, you can see your list items have this CSS applied… .sf-menu li { white-space: nowrap; } You need to change it to… .sf-menu li { white-space: normal; } If you already created a child theme you can make the change there. Otherwise, in the admin go to Appearance … Read more

WP_nav_menu fallback not working

You’ve not added a fallback_cb key to the argument array. You also need to add a theme_location key: php start $menu = wp_nav_menu( array( ‘menu_class’ => ‘reset sf-menu’, ‘container_id’=>’nav’, ‘echo’=>0, ‘fallback_cb’ => ‘mytheme_fallback_function’ // ADD ME!!! ‘theme_location’ => `location_name` // ADD ME, AS DEFINED IN register_nav_menu() ) ); $menu = str_replace(“\n”, “”, $menu); $menu = … Read more

Adding menu items dynamically using wp_nav_menu_objects

You should also specify db_id field for the parent menu item: function epc_add_menu_item( $post_id, $menu_order, $item, $child ) { … $new_item->db_id = $menu_order; … } On a side note, menu item that has children should also have menu-item-has-children class.