Tag: multi level menu

  • WordPress custom menu display

    WordPress custom menu display

    Just a small example of how to build custom menu output in WordPress. $menu_args = array(‘menu’ => ‘Main menu’, ‘echo’ => 0) ; $menu_string = wp_nav_menu($menu_args); $xml = new SimpleXMLElement($menu_string); $out = false; foreach ($xml->ul[0] as $li) { $classes = array(‘current-page-ancestor’, ‘current-menu-item’, ‘current-menu-parent’); if (strstr($li[‘class’], ‘current-page-ancestor’) || strstr($li[‘class’], ‘current-menu-item’) || strstr($li[‘class’], ‘current-menu-parent’)) { $out =…