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 a helping hand in fixing your website issues?

If you are facing any problems in implementing these code snippets and tutorials, you can hire us to fix your website issues.

Hire Us