WordPress   

Get list of menu items from the specific navigation menu in WordPress

$menuLocations = get_nav_menu_locations(); 
//print_r($menuLocations); //Check All menu Location
$menuID = $menuLocations['custom-footer-menu']; 
$primaryNav = wp_get_nav_menu_items($menuID);
foreach ( $primaryNav as $navItem ) { 
	$menuImg = wp_get_attachment_image_src( $navItem->thumbnail_id, 'full' );
	$menuImgSrc = $menuImg[0];
	echo '<div class="menu-item-wrap '.$navItem->classes[0].'">';
	if($menuImgSrc){
		echo '<div class="menu-item-img"><img src="'.$menuImgSrc.'"></div>';
	}
	echo '<div class="menu-item-content"><a href="'.$navItem->url.'" title="'.$navItem->title.'">'.$navItem->title.'</a>';
	if($navItem->description){
		echo '<p class="menu-item-description">'.$navItem->description.'</p>';
	}
	echo '</div></div>';
}
Need Professional Support for Your Website Problems?

Whether you're facing website issues or struggling with code implementation, our team is here to assist. Hire us to get your website back on track.

Hire Us