Getting the Image Title (not the post title)
I've tried over a dozen variations of getting the title now, with mixed results. I get an error, blank output, or the post title, but not the image title.
For reference, here's the complete image code (with my latest attempt) I'm using in posts:
?php if ( has_post_thumbnail() ) : ?
a href=?php $src = wp_get_attachment_image_src( get_post_thumbnail_id( $post-ID ), 'full', false ); echo esc_url( $src[0] ); ? title=?php the_title( $attachment_id ); ??php the_post_thumbnail( 'full', array( 'itemprop' = 'image' ) ); ?/a
?php endif; ?
The specific bit I'm having difficulty with:
?php the_title( $attachment_id ); ?