I’m trying to show an image/icon then the menu item title and then below that the default description from the menu item as well.
I dont understand as when i do the example from the example page (https://www.advancedcustomfields.com/resources/adding-fields-menu-items/) it works, but if i try any changes nothing happens at all!
function my_wp_nav_menu_objects( $items, $args ) {
// get menu
$menu = wp_get_nav_menu_object($args->menu);
// menu name
if( $args->theme_location == 'primary-menu' ) {
// loop
foreach( $items as $item ) {
// vars
$icon = get_field('icons_for_dropdown', $item);
// append icon
if( $icon ) {
'<img src="'.$icon['url'].'" alt="'.$icon['alt'].'" />';
$item->title;
$item->description;
}
}
}
// return
return $items;
}