Home › Forums › General Issues › How to use ALT tags › Reply To: How to use ALT tags
Hi Michelle,
You have to add it inside the loop.. And of course the function should only be added once in functions.php.
Also, make sure you change the fieldname (the first parameter) to the correct one AND also that the field is set to output the image ID.
If you want to use it outside of the loop you could change it to this:
<?php
global $post;
echo get_image_with_alt('NAME OF THE IMAGE FIELD', $post->ID, 'thumbnail'); ?>
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.