Missing Menus Structure

Try adding add_theme_support( ‘menus’ ); in functions.php I haven’t taken the time to investigate. I suspect it depends on what theme is being resolved and how the functions.php is setup. also try to disable auto fill form browser. did you register the menu?? if not then add this to your functions.php function my_theme_setup() { register_nav_menus( … Read more

Inserting additional   into menu item text

Previously I assumed WP would strip HTML, so I never tried it. The HTML below works like a charm, using the WP menu editor: Word <span style=”margin-left: 20px;”> </span> Word (however, inputting &nbsp; didn’t) Alternatively, the CSS trick mentioned by Jacob and Linda would work well too: word-spacing: 3px; My menu item actually has 4 … Read more

Count top level menu items

I am not really sure whether there is some native function for this or not, but you could do it like this: $menu_object = wp_get_nav_menu_object(“Main menu”); $menu_items = wp_get_nav_menu_items($menu_object->term_id); $menu_items_count = 0; foreach ( (array) $menu_items as $key => $menu_item ) { if ($menu_item->menu_item_parent == 0 ) $menu_items_count++; }

Possible to add a dynamic link to a sub-menu via wp_nav_menu_items?

The following code will go through all items and search the first item that has a parent. If found, new item with the same parent will be inserted as “first child”. add_filter( ‘wp_nav_menu_objects’, ‘se336857_dynamic_submenuitem’, 20, 2 ); function se336857_dynamic_submenuitem( $items, $args ) { if ( !is_user_logged_in() || $args->theme_location != ‘account-menu’ ) return $items; $parent = … Read more