Home › Forums › General Issues › Menu Images ALT Tag › Reply To: Menu Images ALT Tag
Sorry, I marked the answer as solved because I thought I had it for a sec, but I still cant get it to work
Below is the code:
// loop
foreach( $items as &$item ) {
// vars
$icon = get_field('menu_image', $item);
// append icon
if( $icon ) {
$item->title = ' <img src="' . $url['url'] . '" class="menu-image" alt="' . $image['alt'] . '"><br>' .$item->title;
}
}
// return
return $items;
I have changed my field to output Image Array and am using the above code but it now wont display the image url or the alt tags….. Not sure what I am missing
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.