sub-menu in top menus, side by side out.
i want to get to the bottom sub ul sub-menus. See the picture:
i set the menu structure second "what are they" sub menu in "from patients" menu.
How can i add submenus to this wp theme?In wp i created parent and child pages, then i updated the menu appearance but the theme puts the buttons side by side.
i found this solutions: https://gist.github.com/hitautodestruct/4345363 but i could not integrate.
Thanks in advance
here the last coding functions.php:
function newtemplate_get_menus_nav($menus){
global $newtemplate_options;
$submenu = array();
$select = '<div class="menu-select"><div class="menu-select-top"><div class="menu-select-title"><span class="ms-title">'.newtemplate_get_options_key('mobile-menu-title').'</span><span class="ms-arrow menu-arrow"></span></div></div><ul>';
$output = '';
$output .= '<div id="navBg" data-align="'.$newtemplate_options['menu-align'].'" data-left="'.$newtemplate_options['menu-padding-left'].'"><nav id="nav"><ul>';
if(count($menus) > 0){
foreach($menus as $menu){
//$id = get_post_meta( $menu->ID, '_menu_item_object_id', true );
if($menu['type'] == 'custom'){
if(strtolower($menu['post_name']) == 'home'){
//Default Home Page
if(get_option('show_on_front') == 'posts' || intval(get_option('page_on_front')) == 0){
$select .='<li data-value="#'.str_replace(' ','_',strtolower($menu['title'])).'">'.$menu['title'].'</li>';
$output .= '<a href="#'.str_replace(' ','_',strtolower($menu['title'])).'">'.$menu['title'].'</a>';
}else{
$post_obj = get_post(get_option('page_on_front'));
$output .= '<a href="#'.str_replace(' ','_',strtolower($post_obj->post_title)).'">'.$menu['title'].'</a>';
$select .='<li data-value="#'.str_replace(' ','_',strtolower($post_obj->post_title)).'">'.$menu['title'].'</li>';
}
}else{
$output .= '<a href="'.$menu['url'].'" target="_blank">'.$menu['title'].'</a>';
$select .='<li data-value="'.$menu['url'].'">'.$menu['title'].'</li>';
}
}else{
if($menu['menu_item_parent']==0){
$output .= '<li><a href="#'.str_replace(' ','_',strtolower($menu['title'])).'" data-id="'.$menu['object_id'].'">'.$menu['title'].'</a></li>';
$select .='<li data-value="#'.str_replace(' ','_',strtolower($menu['title'])).'">'.$menu['title'].'</li>';
}
print_r($menu['post_name']);
print_r("-------");
print_r($menu->object_id);
print_r(".........");
if($menu['post_name'] == $menu->menu_item_parent){
$output .= '<ul class="sub-menu"><li><a href="#'.str_replace(' ','_',strtolower($menu['title'])).'" data-id="'.$menu['object_id'].'">'.$menu['title'].'</a></li></ul>';
$select .='<li data-value="#'.str_replace(' ','_',strtolower($menu['title'])).'">'.$menu['title'].'</li>';
}
//getMenuChilds($menus,$menu['object_id']);
//$menu = wp_get_nav_menu_items('Menu');
//print_r($menu['object_id']);
}
}
} else {
$output .= __('Please open admin backend\'s <strong><em>Appearance -> Menus</em></strong> and your menu with your pages for Primary menu (<em>Theme Locations</em>).','newtemplate');
}
$select .='</ul></div>';
$output .= '</nav></div>'.$select;
//print_r($output);
return $output;
}