Hello I was working with this code.
http://www.advancedcustomfields.com/resources/code-examples/#working-with%20images%20β%20id
The image ID and instead of adding the image title inside the image alt attribute I was wondering if it’s possible to fetch for the real alt text instead of the image title.
I thought this would work but it doesn’t.
$slide_one = '<li><img src="'. $image_one[0] .'" alt="'. get_post_meta( $image_one, '_wp_attachment_image_alt', true ) .'" /></li>';
If someone could look at this and tell me if i’m close here..
π
Problem solved.. π
The variable $image_one doesn’t return the image ID anymore it should be get_field( ‘field_name’ ).
Like this:
$slide_one = '<li><img src="'. $image_one[0] .'" alt="'. get_post_meta( get_field('slide_image_one') ,'_wp_attachment_image_alt', true ) .'" /></li>';