• Hi …..
    I have big problem my nav-menu disapper when wp updeted to v4.0 and i can’t solve this problem it shows one item in menu (contact) the code i use is :

    <div id="pageMenu">
                        <?php wp_nav_menu(array('menu' => 'main-navigation', 'menu_class' => 'mainNavWrapper', 'depth' => '1')); ?>
                        <?php
                        // Getting current page's menu ID;
                        global $wpdb, $post;
    
                        $menu_item_id = $wpdb->get_var('SELECT post_id FROM ' . $wpdb->postmeta . ' WHERE meta_key="_menu_item_object_id" AND meta_value="' . $post->ID . '" ORDER BY meta_id DESC LIMIT 0,1');
    
                        $menu_name = 'main-navigation';
    
                        // Creating empty array to save to children in.
                        $menu_children = array();
    
                        // Loop through all nav menu items
                        $currentNavigationItem = null;
    
                        if (( $locations = get_nav_menu_locations() ) && isset($locations[$menu_name])) {
                            $menu = wp_get_nav_menu_object($locations[$menu_name]);
    
                            $menu_items = wp_get_nav_menu_items($menu->term_id);
    
                            foreach ((array) $menu_items as $key => $menu_item) {
                                if ($menu_item->ID == $menu_item_id)
                                    $currentNavigationItem = $menu_item;
                            }
                        }
    
                        $parent = $menu_item_id;
    
                        if (isset($currentNavigationItem->menu_item_parent) && $currentNavigationItem->menu_item_parent > 0) {
                            $parent = $currentNavigationItem->menu_item_parent;
                        }
    
                        foreach ((array) $menu_items as $key => $menu_item) {
                            // Check if the current menu_item_id is the same as the parent item id.
                            if ($menu_item->menu_item_parent == $parent) {
                                // Save menu item in the empty array.
                                $menu_children[] = $menu_item;
                            }
                        }
    
                        // Print the submenu.
                        ?>
                        <ul class="mainNavSub">
                            <?php
                            foreach ($menu_children as $child) {
                                if ($post->ID == $child->object_id) {
                                    echo "<li class='current-sub-menu-item'>";
                                } else {
                                    echo "<li class='" . $post->ID . "::" . $child->object_id . "'>";
                                }
                                echo "<a href='" . $child->url . "'>" . $child->title . "</a>";
                                echo "</li> \n";
                            }
                            ?>
                        </ul>
                    </div>
                </div>

    can any one help me ?

  • The topic ‘my navmenu disapper when wp updeted v4.0’ is closed to new replies.