First of, get_the_title does not take any other parameter than the ID of the post in question..
What you’re asking for in your first post is the alt text that you’ve put into the image editor in the media library. This is not really part of ACF but is a standard WP thing.
So assuming that the field you’ve wrote in for each image is indeed the alt field your code should look something like this:
This assumes that what you have created in ACF is an image field where you have set the return value to be the images id.
<?php $imageID = get_field('THIS IS YOUR FIELD NAME FOR THE IMAGE'); ?> <?php $image = wp_get_attachment_image_src( $imageID, 'full' ); ?> <?php $alt_text = get_post_meta($imageID , '_wp_attachment_image_alt', true); ?> <img src="<?php echo $image; ?>" alt="<?php echo $alt_text; ?>" />
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've just released ACF 5.12.3 with a security fix to prevent arbitrary file uploads to forms with ACF fields.— Advanced Custom Fields (@wp_acf) July 14, 2022
Now that we've released this update, we recommend updating your sites as soon as possible.
© 2022 Advanced Custom Fields.