Displaying menu items in your desired containers other than ul & li
Copy the below code and paste it anywhere in the functions.php file:
function clean_custom_menus() {
$menu_name = 'homepage-menu'; //Specify Menu Location (This has to be registered first)
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) {
$title = $menu_item->title;
$url = $menu_item->url;
//Edit below code according to your desired needs on how your menu items display
$menu_list .= '' ."\n";
$menu_list .= "\t\t\t\t\t". '' ."\n";
$menu_list .= "\t\t\t". '' ."\n";
}
} else {
//$menu_list = '';
}
echo $menu_list;
}
Copy the below code and paste it anywhere in the theme files where you want to display your menu: